De-compiler assigning boolean value to int data type

I am currently coding a basic terminal program, I have completed and compiled the code in intelliJ. In which i compiled the code with the IDE's compiler, i was interested into seeing what the .class file looks like. So I opened it and looked the compiled program (not the bytecode) which has simplified my .java file. In this compiled file, I've seen various changes. But then i noticed something strange, the compiled code contains something that doesn't look right to me (as a beginner). On the right window, i initialized int type for nimPengguna and assigned it 0. But on the right window (.class file), it seems that the nimPengguna int type was assigned with false (line 28) which is a boolean expression. What caused this? Is it because I assigned 0 in the original file? (sorry the code is a bit messy)
No description
7 Replies
circle
circleOP3y ago
One case i might think caused this from my experience using python is that 0 counts as false, but I am not sure if java works like that.. haha.
Kyo-chan
Kyo-chan3y ago
It's not the compiler doing that, it's the decompiler being weird. Decompilation isn't really expected to work, it's a best-effort. I admittedly never tried to dive deep into what will they try to do specifically and how would they decompile to something like that.*
circle
circleOP3y ago
Oh i'll chnage the topic title then it's so weird
Unknown User
Unknown User3y ago
Message Not Public
Sign In & Join Server To View
Kyo-chan
Kyo-chan3y ago
Hmm, so there wasn't very deep to dive in. I should probably have known that by now
Unknown User
Unknown User3y ago
Message Not Public
Sign In & Join Server To View
circle
circleOP3y ago
Ah makes sense...
Want results from more Discord servers?
Add your server