In Java, does \"binary code\" means the same as \"Java bytecode?\"
Is this the flow in Java ?
Java File (.java) -> [javac] -> ByteCode File (.
There's no such thing as "machine-independent-bytecode" (it wouldn't make any sense if you think about it). Bytecode is only (for the purposes of this answer) used for things like virtual machines. VMs (such as the JVM) INTERPRET the bytecode and use some clever and complicated just-in-time compilation (which IS machine/platform-dependent) to give you the final product.
So in a sense, both of the answers are right and wrong. The Java compiler compiles code into Java bytecode (machine-independent). The *.class
files the bytecode is located in are binary - they are executable, after all. The Virtual machine later interprets these binary *.class
files (note: when describing files as binary, it's somewhat of a misnomer) and does various awesome stuff. More often than not, the JVM uses something called JIT (just-in-time compilation), which generates either platform-specific, or machine-specific instructions that speed up various parts of execution. JIT is another topic for another day, however.
Edit:
Java File (.java) -> [javac.exe] -> ByteCode File (.class) -> [JVM/Java Interpreter] -> Running it(by first converting it into binary code specific to the machine)
This is incorrect. The JVM doesn't "convert" anything. It simply interprets the bytecode. The only part of the JVM that "converts" bytecode is when the JIT compiler is invoked, which is a special case and should not be generalized.