Learning a
basic program Hello World! Would have given you an idea of the simple structure
of a Java Program.
Now let us
see how the javac compiler actually compiles your program and translates your
High level source code into Byte code and is passed to java Interpreter. So
before going any further let us discuss what exactly is Byte code.
The Byte
Code:
Byte code is
an intermediate code which is given by the javac compiler after compiling the
java program. The specialty of Byte code is that it is machine Independent,
i.e. the byte code can run on Windows, Mac, Linux etc or any of the machines
that exist.
To be clear
let me give an example.
Suppose you
have Windows OS installed on your computer and you even need Linux OS for some
work of your choice, but you are not interested in dual booting the above
mentioned Operating systems so the another option you have is to use a Virtual
machine to get your job done.
But in Java
it already has JVM(Java virtual machine) built in it. This makes the java as
Platform independent and so while installing Java on your system the JVM gets
automatically configured and the byte code given by the compiler is passed to
JVM or Java Interpreter(in a same way) .This interpreter translates the byte
code to machine code and executes the program.
The below
picture tries(in a way) to show the above metioned scenario.
In the next post we will cover how we use some simple math functions in java program.

No comments:
Post a Comment