Notes

  • int, boolean, char, and double are primitives
  • Strings and other classes are objects
  • Compare primitives with == and objects with .equals()
  • Objects have properties while primitives do not

Homework

2006 FRQ 2a

public double purchasePrice () {
    return getListPrice() * (1 + taxRate);
}

2006 FRQ 3a

public int compareCustomer (Customer other) {
    int compare = getName().compareTo(other.getName());
    if (compare == 0) {
        compare = getID() - other.getID();
    }
    return compare
}