How a Bytecode looks?

How a Bytecode looks?


One of the features of Java is platform independent. It achieves platform Independence through bytecode generation. Let us compile a simple Java program to see how bytecode looks.
Following is the example code to see the bytecode that prints "Hello World".

For the above program following is the bytecode generated (If you want to know, I got JDK 1.6 loaded).
bytecode

Do not alter the bytecode, and if altered, the JVM throws exception.

Something More

This byte code generated at compile time is not known to the OS and the Microprocessor to execute later to get output. This byte code is to be converted back to binary code compatible to Microprocessor. This is done by JVM (Java Virtual Machine). The binary code generated in platform dependent. That is, the same byte code is converted to different formats of binary code by JVM as per underlying platform (OS).

JDK comes with two main components – Compiler and JVM. Other components are byte code verifier, class loaders, Garbage collector etc.

Know the syntax of writing a Simple Java program and steps of Compilation and Execution.

1. Basic Class Structure, Compilation and Execution
2. Data Binding Data Hiding Encapsulation

Leave a Reply

Your email address will not be published. Required fields are marked *