public class SpeciesEqualsDemo
1:
2: public class SpeciesEqualsDemo
3: {
4: public static void main(String[] args)
5: {
6: Species s1 = new Species( ), s2 = new Species( );
7: s1.set("Klingon Ox", 10, 15);
8: s2.set("Klingon Ox", 10, 15);
9: if (s1 == s2)
10: System.out.println("Match with ==.");
11: else
12: System.out.println("Do Not match with ==.");
13: if (s1.equals(s2))
14: System.out.println("Match with the method equals.");
15: else
16: System.out.println(
17: "Do Not match with the method equals.");
18: System.out.println(
19: "Now we change one Klingon Ox to all lowercase.");
20: s2.set("klingon ox", 10, 15);
21: if (s1.equals(s2))
22: System.out.println("Still match with the method equals.");
23: else
24: System.out.println(
25: "Do Not match with the method equals.");
26: }
27: }