Java - Is binary code the same as ByteCode?

前端 未结 6 1016
后悔当初
后悔当初 2021-01-31 03:33

In Java, does \"binary code\" means the same as \"Java bytecode?\"

Is this the flow in Java ?

Java File (.java) -> [javac] -> ByteCode File (.

6条回答
  •  伪装坚强ぢ
    2021-01-31 04:15

    When the talk is going about programs then term binary code usually denote executable program in binary form (encoded as a sequence of bits). In other words binary code is any compiled program as opposed to scripts which are distributed and executed (interpreted) in the form of text.

    Binary code can be of two kinds: machine code and bytecode. Machine code is a program encoded in accordance to specification of real hardware microprocessor. Thus, it can be executed directly by target microprocessor without mediation of any other software. In contrast, bytecode is a program encoded in accordance to specification of some virtual microprocessor (virtual machine). Hence, for execution it can be either interpreted or translated into machine code and then directly executed.

    In this way, every bytecode is a binary code, but not every binary code is bytecode. In the context of your question, "Java bytecode" is unconditionally a "binary code", but "binary code" will not necessary be "Java bytecode", but can be "Java bytecode".

提交回复
热议问题