public class Test {
    public static void main(String[] args) {
        Integer i1 = 1000;
        Integer i2 = 1000;
        System.out.println(i1 == i2);
        System.out.println(i1 == 1000);
    }
}
    "Each time you convert a value of 1000 into an object wrapper a new Integer instance is created." It is relevant to say that for values from -128 to 127 an object will be taken from the pool of Integers.
2016 Jan 31, 8:12:38 PM
Login in to like
Login in to comment