Horje
Byte Code in Java

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.

Java

/*package whatever //do not write package name here */
import java.io.*;
  
class GFG {
    public static void main (String[] args) {
        System.out.println("GFG!");
    }
}

Output

GFG!
  • 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.




Reffered: https://www.geeksforgeeks.org


TrueGeek

Related
Difference between TCAM and CAM Difference between TCAM and CAM
Computational Complexity v/s Chomsky Hierarchy Computational Complexity v/s Chomsky Hierarchy
Monotonic Reasoning vs Non-Monotonic Reasoning Monotonic Reasoning vs Non-Monotonic Reasoning
Understanding Multi-Layer Feed Forward Networks Understanding Multi-Layer Feed Forward Networks
Why to Use ASP.NET Server Controls in Place of HTML Controls? Why to Use ASP.NET Server Controls in Place of HTML Controls?

Type:
Geek
Category:
Coding
Sub Category:
Tutorial
Uploaded by:
Admin
Views:
9