public class EqualsTest { public static void testPrimitive() { int one=2; int two=2; int three=one; System.out.println("one : "+one); System.out.println("two : "+two); System.out.println("three : "+three); System.out.println("one == two : "+ (one == two) ); System.out.println("one == three : "+ (one == three) ); } public static void testClass() { Integer one=new Integer(2); Integer two=new Integer(2); Integer three=one; System.out.println("one : "+one); System.out.println("two : "+two); System.out.println("three : "+three); System.out.println("one.equals(two) : "+ (one.equals(two))) ; System.out.println("one == two : "+ (one == two) ); System.out.println("one.equals(three) : "+ (one.equals(three))); System.out.println("one == three : "+ (one == three) ); } public static void main(String[] args) { testClass(); } }Dosyayı İndir