How java is platform independent?
Answer Posted / sushil vashist
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 ? | 0 Yes | 0 No |
Post New Answer View All Answers
What are static methods?
What is the purpose class.forname method?
Is null or empty java?
What is variable explain with example?
What is the difference between superclass and subclass?
How do I remove a character from a string in java?
Explain the scope of a variable.
Why are the methods of the math class static?
Can you make a constructor final in Java?
Which eclipse is best for java?
What are internal and external variables?
What is OOP Language?
Does java set allow duplicates?
Explain with example the concept of constant variable in java.
What are the types of collections in java?