/****
 * Some examples of object data values, as discussed in Lecture Notes 2.
 */

public class NonPrimitiveVars {

    public static void main(String[] args) {

        String s = "xyz";
        int[] a = {1, 2, 3};
        Rectangle r = new Rectangle(10, 20, 100, 200);

        /*
         * Here are some tests of how non-primitive types compare for equality.
         * See Lecture Notes week 2 for some discussion of these examples.
         */
        System.out.println(s == "xyz");         // true
        System.out.println(s == "abc");         // false

        int[] a2 = {1, 2, 3};
        System.out.println(a == a2);            // false
        System.out.println(a.equals(a2));       // false (what's up here?)

        Rectangle r2 = new Rectangle(10, 20, 100, 200);
        System.out.println(r == r2);            // false
        System.out.println(r.equals(r2));       // true (why does this work?)
    }

}