Skip to content
Related Articles
Get the best out of our app
Open App

Related Articles

Byte Code in Java

Improve Article
Save Article
Like Article
Improve Article
Save Article
Like Article

Byte Code

Byte Code can be defined as an intermediate code generated by the compiler after the compilation of source code(JAVA Program). This intermediate code makes Java a platform-independent language.

How is Byte Code generated?

Compiler converts the source code or the Java program into the Byte Code(or machine code), and secondly, the Interpreter executes the byte code on the system. The Interpreter can also be called JVM(Java Virtual Machine). The byte code is the common piece between the compiler(which creates it) and the Interpreter (which runs it).

Let us look at this phenomenon, step by step

  • Suppose you are writing your first JAVA program.


/*package whatever //do not write package name here */
class GFG {
    public static void main (String[] args) {


  • The above-written code is called JAVA source code.
  • The compiler compiles the source code.
  • Finally, Interpreter executes the compiled source code.

Whenever we write any program, it is not written in machine code. We write it in a high-level language like JAVA, C++, Python, etc. But the computer understands only the machine code. So when we execute our program, it is first converted into machine code or Byte code by the compiler and then executed by the Interpreter. 

This intermediate code or the byte can run on any platform making, JAVA a platform-independent language.

My Personal Notes arrow_drop_up
Last Updated : 19 Oct, 2021
Like Article
Save Article
Similar Reads
Related Tutorials