Actually, the question is a bit broader.
I know that javac compiles java file into a bytecode, a class file. So, class file should contain jvm instructions and all that. On the other hand, the only way to see those instructions is to decompile class file with javap -c. But it isn’t decompiling, right? Because if it was decompiling, it would produce java file. So, my guess here is that javac compiles java file like 2 times (which isn’t actually true, but let’s assume that for simplicity), first to jvm instruction, then to bytecode, so javap -c decompiles from bytecode to jvm instructions. Jvm supposed to understand bytecode, thus it can’t understand instructions. I’m a bit confused here. Could someone explain what’s going on here?
Actually, the question is a bit broader. I know that javac compiles java file
Share
Javap doesn’t decompile the bytecode, it disassembles it. To explain the difference, we can switch the terms the other way around: compilation is translating human readable code to bytecode whereas assembly is translating assembly instructions to bytecode.