Comparing Integer/Long/Short/Float/Double with ‘equals’ method.
maj 3rd, 2011
2 comments
Integer i7 = 7; long l7 = 7L; System.out.println(i7.equals(l7));
Wynikiem jest false.
public boolean equals(Object obj) { if (obj instanceof Integer) { return value == ((Integer)obj).intValue(); } return false; }