java.lang.Comparable<Disk>public class Disk extends java.lang.Object implements java.lang.Comparable<Disk>
| Modifier and Type | Field | Description |
|---|---|---|
private int |
radius |
an integer that holds the radius of the disk
|
| Constructor | Description |
|---|---|
Disk(int r) |
Constructs a disk using a given radius.
|
| Modifier and Type | Method | Description |
|---|---|---|
int |
compareTo(Disk o) |
Compares this disk with another disk and returns an integer representing
that comparison.
|
java.lang.String |
toString() |
Returns a String representation of the disk, namely its radius.
|
public Disk(int r)
throws java.lang.IllegalArgumentException
r - the radius of the disk to be createdjava.lang.IllegalArgumentException - if r is not valid because it is
less than or equal to zeropublic int compareTo(Disk o)
compareTo in interface java.lang.Comparable<Disk>o - the other Disk that this disk is being compared toComparable.compareTo(java.lang.Object)public java.lang.String toString()
toString in class java.lang.ObjectObject.toString()