why can the same Java source program file like helloworld ja
why can the same Java source program file like helloworld. java run on any systems including windows, oven,mac washing machine?
Solution
First you have to understand what is the mean of platform? Platform consists of the computer hardware(mainly architecture of the microprocessor) and OS. Platform=hardware+Operating System
Anything that is platform indepedent can run on any operating system and hardware.
Java is platform indepedent so java can run on any operating system and hardware. Now question is how it is platform independent?
This is because of the magic of Byte Code which is OS indepedent. When java compiler compile any code then it generate the byte code not the machine native code(unlike C compiler).Now this byte code need a interpreter to execute on a machine.This interpreter is JVM.So JVM read that byte code(that is machine indepedent) amd execute it. Different JVM is designed for different OS and byte code is able to run on different OS.
