Mountainspublic class Mountains extends Object implements Comparable
Fields Summary |
---|
private String | name | private int | height |
Constructors Summary |
---|
public Mountains(String name, int height)
setDetails(name,height);
|
Methods Summary |
---|
public int | compareTo(java.lang.Object o)
Mountains m = (Mountains) o;
if(m.height < height) {
return -1;
} else if (m.height == height) {
return 0;
}
return 1;
| public void | displayDetails()
System.out.println("Mountain "+name+ " is "+height+" metres high");
| public int | getHeight()
return height;
| public java.lang.String | getName()
return name;
| public void | setDetails(java.lang.String name, int height)
this.name = name;
this.height = height;
|
|