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)7 Replies
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.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.*
Oh i'll chnage the topic title then
it's so weird
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
Hmm, so there wasn't very deep to dive in. I should probably have known that by now
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
Ah
makes sense...