+ 1
Can anyone help me in understanding the Java code which is attached here?
why output is helloworld why not helloworldhello https://code.sololearn.com/cHQZojT4rbl8/?ref=app
4 odpowiedzi
+ 9
Because the value of the Integers are the same, but they're not the same objects in memory. == compares the memory refence. You can compare the values with the valueOf method of Integer.
+ 9
You're welcome.
+ 3
But when the values assigned to Integer range from (-128 to 127)...
the == returns true ,when they are same.
https://code.sololearn.com/c8a4P26uYmbG/?ref=app
+ 2
got it. thank you mam