please tell the the difference between == and equals method in wrapper class... For example Integer i1 = 10;Integer i2 =10:
System.out.println(i1==i2) will evaluates true and i1.equals(i2) will also evaluates true..... but in another example Integer i1 = 1000;Integer i2 =1000:
System.out.println(i1==i2) will evaluates false and i1.equals(i2) will evaluates true. tell me how exactly == and equals work in wrapper class .the == evaluates true upto 127 why is it so....?
[MG Edited to take out the confusing smilies in the subject line]
Creativity is nothing but Breaking Rules
Joined: Apr 29, 2009
Explanation by Jesper Young in the below post, should answer your question..