How java is platform independent?

Answer Posted / steve

Java was designed to not only be cross-platform in source
form like C, but also in compiled binary form. Since this is
frankly impossible across processor architectures Java is
compiled to an intermediate form called byte-code. A Java
program never really executes natively on the host machine.
Rather a special native program called the Java interpreter
reads the byte code and executes the corresponding native
machine instructions. Thus to port Java programs to a new
platform all that is needed is to port the interpreter and
some of the library routines. Even the compiler is written
in Java. The byte codes are precisely defined, and remain
the same on all platforms.

The second important part of making Java cross-platform is
the elimination of undefined or architecture dependent
constructs. Integers are always four bytes long, and
floating point variables follow the IEEE 754 standard for
computer arithmetic exactly. You don't have to worry that
the meaning of an integer is going to change if you move
from a Pentium to a PowerPC. In Java everything is guaranteed.

However the virtual machine itself and some parts of the
class library must be written in native code. These are not
always as easy or as quick to port as pure Java programs.

Is This Answer Correct ?    4 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Name few "optional" classes introduced with java 8 ?

639


What is string in java is it a data type?

531


What is exception hierarchy in java?

584


What are the benefits of operations?

509


What is google full form?

532






What does three dots mean in java?

643


What is a methodologist?

528


What is garbage collector?

618


How do you convert boolean to boolean?

519


How many types of parsers are there?

540


What are the common uses of "this" keyword in java ?

569


How to do a true java ping from windows?

612


Is string a datatype?

550


What is the difference between the jdk 1.02 event model and the event-delegation model introduced with jdk 1.1?

610


What is java jit compilers?

556