java - Why Comparison Of two Integer using == sometimes works and sometimes not? -


i know comparing reference while i'm using == not idea did not understand why happening.

integer a=100; integer b=100; integer c=500; integer d=500; system.out.println(a == b); //true system.out.println(a.equals(b)); //true system.out.println(c == d); //false system.out.println(c.equals(d)); //true 

the java language specification says wrapper objects @ least -128 127 cached , reused integer.valueof(), implicitly used autoboxing.


Comments

Popular posts from this blog

javascript - Google App Script ContentService downloadAsFile not working -

javascript - Function overwritting -

php - Find a regex to take part of Email -