+ 2

Explain me? please...

my java code's Output make me more confused. please ! Run the code and explain me. https://code.sololearn.com/cicvDNP7CAYQ/?ref=app

11th Sep 2019, 3:28 PM
𝙰ɴᴏɴʏᴍᴏᴜ𝚜
𝙰ɴᴏɴʏᴍᴏᴜ𝚜 - avatar
7 Respostas
+ 3
Like what Ali said.. If you use integer type then the value will become an object it gets wrapped so you can call methods on it. Behind the scenes with integer when you compare variables/refreneces that have the same value it works "similar" to how duplicate strings work in string pool instead of creating the same value again it will use an existing one so therefore they share the same refrenece. integer x = 100; integer y = 100; these both refer to the same value.
11th Sep 2019, 4:04 PM
D_Stark
D_Stark - avatar
+ 3
~ swim ~ exactly 👍 i couldn't remember the range I wonder why they didnt just store it as a string and just convert it afterwards because this is somthing you wouldent know unless you seen the source code 🤔
11th Sep 2019, 4:18 PM
D_Stark
D_Stark - avatar
+ 2
Don't write "Integer", write "int".
11th Sep 2019, 3:52 PM
KfirWe
KfirWe - avatar
+ 1
if ( (int) num3 == (int) num4 ) {
11th Sep 2019, 7:31 PM
zemiak
+ 1
nice
11th Sep 2019, 8:45 PM
Juan Debenedetti
Juan Debenedetti - avatar