Why Java is platform independent? How it is independent from different platform ? if you take C program, it also runs same as on different machine ?
[B]Question asked by visitor prakashreddy[/b]
Printable View
Why Java is platform independent? How it is independent from different platform ? if you take C program, it also runs same as on different machine ?
[B]Question asked by visitor prakashreddy[/b]
The Java code that you compile gets converted to a form known a bytecode that is present in the .class files.
Every OS has its own JVM. The JVM takes this bytecode and then executes the program. So the hardware dependency is taken care of by the JVM.
Hence Java is platform independant.
A C program will have to be recompiled for it to run on different OS's. Thus it is platform dependant
Regards,
Sahil.
[SIZE=1][COLOR=Silver]--Smile, it makes people wonder what you are thinking!!! :)[/COLOR][/SIZE]
The Java code that you compile gets converted to a form known a bytecode that is present in the .class files.Every OS has its own JVM. The JVM takes this bytecode and then executes the program. So the hardware dependency is taken care of by the JVM.
Hence Java is platform independant.
java is platform independent because it converts the given source code into byte code.every operating system has its own byte code so the java is platform independent