-
Notifications
You must be signed in to change notification settings - Fork 0
What makes Java platform independent?
Aparna edited this page Aug 13, 2017
·
5 revisions
With Java,
- When java compiler compiles any code, it generates the byte code, not the machine code.
- Now this byte code need a interpreter to execute on a machine.
- This interpreter is JVM (Java Virtual Machine).
- So JVM reads that byte code and executes it on the machine.
- Different JVM is designed for different OS and byte code is able to run on different OS.
Thus Java is designed such that it is executed on a JVM and not the machine itself, there by making it machine independent.
But if we consider C/C++,
- compiler generates the .exe file that is OS dependent.
- So when we run this .exe file on another OS it will not run because this file is OS dependent.
- So is not compatible with the another OS.
- Thereby C and C++ are machine dependent languages.