Post

🌒 Eclipse Java IDE
🌒 Eclipse Java IDE@EclipseJavaIDE·
What will be the output of this program? (don't cheat!)
🌒 Eclipse Java IDE tweet media
English
72
44
167
0
gorlok 🧉🧙‍♂️
@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
0
0
14
0
Ben ☘️
Ben ☘️@BMasonJ14·
@EclipseJavaIDE False due to the way Integers are cached. The numbers -128 to 127 are cached.
English
1
0
2
0
InfernoDeity
InfernoDeity@InfernoDeityInf·
@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
0
1
0
0
Miguel
Miguel@NoPainNoVocaine·
@EclipseJavaIDE False, since "==" checks for reference(location in memory) as opposed to value.
English
0
0
2
0
Pranit Kokne
Pranit Kokne@KoknePranit·
@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
0
0
0
0
Paylaş