Ticker

6/recent/ticker-posts

Java (Java Bytecode)

WHAT IS JAVA BYTECODE?


Java bytecode is an instruction set for the JVM (Java Virtual Machine). It acts as an assembler, which is an alias representation for C++ code. 


When Java is compiled, the Java bytecode is generated. 
The Java bytecode is machine code in the form of a .class file and with the help of Java bytecode, we achieve platform independence feature in Java.






HOW THE BYTECODE WORKS?
When we write a program in Java, 
then the Javac compiler compiles Java (.java) source code program and generate the bytecode for that Java source code program and when we wish to run this .class file on any other platform, so we can run it, by the Java Virtual Machine. 

This means that we only need to install the basic java on any platforms that we want to run our code on. 


BYTECODE STRUCTURE
Bytecode Structure


ADVANTAGE OF JAVA BYTECODE
Platform independence is one of the main feature provided by Java and this the main reason, for that James Gosling started the formation of Java programming language.


As already discussed, the platform independence features maily implemented by bytecode which helps us to achieve this. 

Hence bytecode is a very important part of the all java programs.

The JVM instructions may differ from system to system but these all can interpret the bytecode. 

A point should be keep in mind, that is, bytecodes are non-runnable codes and rely on the availability of an interpreter to execute and thus the JVM comes into play.















Post a Comment

0 Comments