Why Java is platform independent? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Why Java is platform independent?

31st Oct 2019, 8:40 AM
Sujit Tamang Gole
Sujit Tamang Gole - avatar
3 Answers
+ 2
There are many platforms like Windows, Linux, Solaris etc The reason why Java is platform-independent is because java programs developed on one platform(say windows) can easily run on other platform(like Linux) without any modification. JVM makes java platform independent. Every platform has its own implementation of JVM that reads same .class file
31st Oct 2019, 9:11 AM
Rishi Anand
Rishi Anand - avatar
+ 1
Adding to Rishi's answer Most compiled languages turn your source program into a machine code that is specific to the hardware (CPU, etc) and operating system that it is compiled on. That makes the final code unportable, so if you compile a C program on Linux, you can't run it on Windows. On the other hand, Java compiles into an intermediary 'bytecode' that is no longer readable by human eyes, but portable and runnable by the platform-specific java virtual machine.
31st Oct 2019, 10:08 AM
Tibor Santa
Tibor Santa - avatar
0
To be clear with the subject of the question, you can put 'Java' into the Relevant Tags section. 'ss' doesn't seem to have any relevance to the question so it's better if you take it out 👍
31st Oct 2019, 9:25 AM
Ipang