Hello EveryOne, I was just playing around the wrapper classes and observed some unexpected behaviour. public class HelloWorld { public static void main( String args[] ) { Integer i1 = 100; Integer i2 = 100; System.out.println( "i1 == i2 : " + ( i1 == i2 ) ); } } Output of the above code is unexpected with different values of ...
Hello EveryOne, I was just playing around the wrapper classes and observed some unexpected behaviour. public class HelloWorld { public static void main( String args[] ) { Integer i1 = 100; Integer i2 = 100; System.out.println( "i1 == i2 : " + ( i1 == i2 ) ); } } Output of the above code is unexpected with different values of ...
consider the following two cases 1) Integer i3 = 127; Integer i4 = 127; if(i3 == i4) System.out.println("same object"); ----------- 2) Integer i3 = 128; Integer i4 = 128; if(i3 == i4) System.out.println("same object"); ------------- in case 1 we get same object as output. In the second case we don't get same object printed. when the object i3 & i4 is ...