What happens in java first we compile the .java file to .class file.
This .class file is nothing but byte code(combination of 0s and 1s)
This byte code is platform independent that means we can run the same .class file in any operating system like windows, linux, mac etc
Then the java virtual machine interprites the code and generates the required output.
So java is both compiled and interprited language.

Bytecodes are the machine language of the Java virtual machine.
When a JVM loads a class file, it gets one stream of bytecodes for each method in the class. The bytecodes streams are stored in the method area of the JVM.

A method's bytecode stream is a sequence of instructions for the Java virtual machine. Each instruction consists of a one-byte opcode followed by zero or more operands. The opcode indicates the action to take.

No comments:

Post a Comment