double x = 44.5; double y = 44.5; Double xW = new Double(x); Double yW = new Double(y); Double dd = new Double(34.239485); double val = xW.doubleValue(); if (xW < yW) // can't use < > on class types if (xW.compareTo(yw) < 0) // means xW < yW if (Double.compare(34.2, 23.4) < 0) ----------------------------------------------------------- public class StudentID { private String name; private int id; /**** instance methods ************/ public void setName(String n) { this.name = n; // "this" is optional } public String getName() { return name; } public void setId(int id) { this.id = id; // "this" required because same name } public int getId() { return this.id; // "this" is optional } public String getEmailAccount() { return "" + this.name.charAt(0) + this.id + "@jhu.edu"; } public boolean isValid() { return this.id >= 100000 && this.id <= 999999; } } main { // missing parts student = new Student(); // student.name = name; student.setName(name); student.setId(stdIn.nextInt()); while (! student.isValid()) { student.setId(stdIn.nextInt()); } System.out.println(student.getEmailAccount()); } public class Test { private int x; // instance private static int y; // class public void doIt() // instance { x =1; y=2; } public static void tryIt() // class { // x = 3; // can't refer to instance data in static method y = 4; } public String toString() { return x + " " + y; } public static void main(String [] args) { // doIt(); // must call with an object tryIt(); // ok because in same class as main Test t = new Test(); t.doIt(); // Test.doIt(); // must call with an object Test.tryIt(); // ok from anywhere t.tryIt(); // ok, but doesn't make sense Test t1; Test t2 = new Test(); t1 = new Test(); t1.doIt(); Test.tryIt(); t2.doIt(); System.out.println(t1 + " " + t2); } }