HOW JAVA WORKS


In this tutorial, we are going to learn about how Java works on different platforms as well as understand how the code execution of Java happening through a visual representation.


How Java Works?

So far we have learnt about Java which is a high level programming language that allows software developers to write programs that are free from a defined type of computer. High level computer languages are easier to read, write and debug but certainly there should be a compiler in between the programming language and the computer machine to compile or interpret code so that it can be executed to a language that a computer understands.






Platform Independent Java

Since Java is a portable language it means that it can be run on any operating system let us see visually how that is possible.

portable java
In the above diagram you will see that on the top of every operating system there is a Java Virtual Machine which is needed to run the Java program. JVM or Java Virtual Machine enables the computer to run a java program, since every operating system has its own JVM so it is a platform independent environment that simply converts Java into code that a computer understands.

How Java Code is Executed?

Let us see in a chronological order as to what happens happens with the code that a developer writes in Java.

How java code is executed

In the above figure you can clearly see that how Java code is compiled and converted to bytecode which helps interpret and execute through the Java virtual machine on the tools in operating system this is how is our works. In short it is the working of of the Java programming language that makes it easy to compile and interpret and makes it a programming language that has a lot of features for general purpose as well as for the web.

Now you have seen visually that how Java works on different platform and how the java code is executed y going through compilers, you are ready to install Java on your preferred system and start coding!