Why is java platform independent
Java Solves the problem of platform independence by using byte code.
Java compiler does not produce native code like a C compiler which got binded to machine.
Java makes it possible to create binary executables that will run unchanged on multiple platforms.
When Java program is compiled, it is converted into bytecode rather than machine code.This bytecode is the intermediate code that can be run on any platform that have JVM.This bytecode does not get binded to any particlular machine.This means that you can compile your java program (for example test.java)
on window which generate byte code (test.class).You can run this bytecode on linux or any other machine
Java's bytecodes are desgined to be read and interpreted in exactly same manner on any computer hardware or operating system that supports Java Runtime Environment.
Java Virtual Machine is a virtual operating system that enables a Java program can be run .We are
Calling a Java platform-independent Java program will be different outputs on different machines, but
Platform, give different results when the dependent programs are compiled on different machines
Updated On: Sep 18, 2011