Post

@EclipseJavaIDE @java i1 points to a memory address and i2 points to another, so, false, i1.equals(i2) true
English

@EclipseJavaIDE False.
Integer keeps a cache of instances in the range of -128 to 127. For safety, must be used equals()/compare() with wrapper types.
English

@EclipseJavaIDE False due to the way Integers are cached. The numbers -128 to 127 are cached.
English

@EclipseJavaIDE @java Not guaranteed. valueOf may cache and true may result, or valueOf may not and false is the result. Never use identity sensitive components with Value Based Classes
English

@EclipseJavaIDE @EclipseFdn Not equal. Unless I'm mistaken, 128 falls just outside of the range of cached boxed Integers, so an identity comparison will result in false.
English

@EclipseJavaIDE False, since "==" checks for reference(location in memory) as opposed to value.
English

@EclipseJavaIDE @EclipseFdn False because object references
English

@EclipseJavaIDE @java false
the == operator is used to compare the value.
since i1 and i2 are of Integer type i.e object type i1 and i2 will refer to two different objects.
if i1 and i2 are of primitive type then we will get true.
English

@EclipseJavaIDE @java False.. as range of cache is -128 to 127.
English

@EclipseJavaIDE It will return 128. -128+256 = 128. Therefore 128 == 128.
English

















