Java is a high level object oriented language. When we compile java code it first gets converted into highly efficient byte code by the java compiler. The generated byte code is then interpreted by a peace of software called java virtual machine.
What is java virtual machine?
Java virtual machine is the software which interprets compiled java byte code and runs the java program. Java virtual machine is also known as JVM.
As Java code is first compiled into byte code and then the java virtual machine interprets and runs the code, java has achieved the platform independence. Java virtual machine is available for almost all the platforms, right from windows to various handheld devices.
How Java Virtual Machine works ?
JVM does not have any information regarding the programming language. It knows only binary format of the byte code. The class file generated by the java compiler contains the byte code in the format which JVM can understand. We can generate the byte code that adhers to this format in any programming language.
Every java program must run within the boundries defined by the JVM. The code run inside the JVM can not go beyond the security constraints defined by the JVM. This is one of the reason why java application are considered as secure applications over internet.