What makes Java Platform Independent?
PLATFORM: A Platform is an environment in which a program runs. In simple terms it is combination of Operating system and Processor.
Windows 8+Intel – Core i5 (is a diff. platform)
Linux + AMD -A6(is another diff platform)
Mac + Intel -Core i3(is yet another different platform)
Now being platform independent means that an application developed and compiled over one platform can be executed over any other platform without any change in the code.
And , Java has this capability using the concept of “bytecode” and “JVM”
Whenever we compile a java program , the compiler never generates machine code.
Rather it gnerates a machine independent code called the “bytecode”.
This bytecode is not directly understandable by the platform(OS & CPU).
So another special layer of software is required to convert these bytecode instructions to machine dependent form
This special layer is the JVM , that converts the bytecode to underlying machine instruction set and runs it.
Program Execution in C/C++
Graphical Representation-Program Execution in C/C++
Program Execution in Java
Ask your questions and clarify your/others doubts by commenting. Java Documentation