This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class IntLongWat { | |
public static void main(String[] args) { | |
System.out.println(new Integer(1).equals(1)); // true | |
System.out.println(new Long(1).equals(1)); // false, it only equals 1L - so much for semantic equivalence | |
System.out.println(new Integer(1).equals(new Long(1))); // false... Y U NO EQUAL? | |
// although | |
System.out.println(new Integer(1) == 1); // true |