How java is platform independent?

Answers were Sorted based on User's Feedback



How java is platform independent?..

Answer / ranganathkini

In the classic sense of software development, programs are
coded in higher level languages such as C/C++, then that
source code needs to be compiled into native machine
language specific to that platform so that the program is
made executable.

Java compiler on the other hand does not compile Java source
files into native machine language, instead it compiles the
source code into bytecodes. These bytecodes are platform
independant i.e. in other words specific to to the Java
Virtual Machine specification. This enables platform
independant compilation.

When the bytecode compiled programs are executed thru the
Java interpeter, it converts those bytecodes into native
machine code and executes them thru the JVM which is
specific to host environment it is running on. This enables
platform specific execution.

Is This Answer Correct ?    380 Yes 37 No

How java is platform independent?..

Answer / invisible

When you write the program for any programming language it
is called (source program), and it will have the extension
depending upon the language. For example, the C language
will have the extension ".c" and ".cpp" in C++.
When you compile the file or (source program), you will get
the ".exe" extension. This ".exe" file is executed by the
operating system in the C & C++ program.
If you are writing the program and compile it in one
operating system, you cannot take the same ".exe" file to
another operating system for extension. That means, this
program depends upon the operating system for its execution.

In Java, when you write the program, you will have
the ".java" file. And when it is compiled, you will get
the ".class" file. The ".class" file is executed by the
Java Virtual Machine (JVM). If you have the JVM, you can
execute the java program anywhere under operating system.
That means, that Java is PLATFORM INDEPENDENT.

Is This Answer Correct ?    191 Yes 18 No

How java is platform independent?..

Answer / devarathnam c,kotagudibanda(po

Hi... Java is a platform independent language.After
compiling the ".java" file ,that will be converting into
the ".class" file,which is a byte code having the
capability run on any OS.Basing on the concept byte code
java achieving the platform independent,it leads to "Write
onece run anyware".

Is This Answer Correct ?    196 Yes 54 No

How java is platform independent?..

Answer / rinky sharma

when java code is compiled a bytecode is generated which is
independent of the system.This bytecode is fed to the JVM
(java virtual machine)which is resided in the system.Since
every system has its own JVM,it does'nt matter where u
compile the source code.The bytecode generated by the
compiler can be interpreted by any JVM of any machine.

Hence it is called platform-indepented language.

Is This Answer Correct ?    62 Yes 12 No

How java is platform independent?..

Answer / vinay

I am giving the answer more clear.
JVM is O.S Dependent ,i.e different operating systems require
their own specific jvm.

the thing what is platform independent is
the byte code generated by java compiler "javac"
this byte code can be run on any real world object as long as
jre(consists jvm) is exists.jre should be under some
operating system.

Is This Answer Correct ?    18 Yes 9 No

How java is platform independent?..

Answer / bandana mankotia

Platform Independent means the process in which certain
languages is capable of running on all types of Operating
System.
Java is platform independent bcoz In java when we
execute the source code,it generates the class file
comprising the bytecode.Byte code are easily interpreted by
JVM(interpreter)which is available with every type of O.S
we install

Is This Answer Correct ?    25 Yes 17 No

How java is platform independent?..

Answer / santosh sahu

When you write the program for any programming language it
is called (source program), and it will have the extension
depending upon the language. For example, the C language
will have the extension ".c" and ".cpp" in C++.
When you compile the file or (source program), you will get
the ".exe" extension. This ".exe" file is executed by the
operating system in the C & C++ program.
If you are writing the program and compile it in one
operating system, you cannot take the same ".exe" file to
another operating system for extension. That means, this
program depends upon the operating system for its execution.

In Java, when you write the program, you will have
the ".java" file. And when it is compiled, you will get
the ".class" file. The ".class" file is executed by the
Java Virtual Machine (JVM). If you have the JVM, you can
execute the java program anywhere under operating system.
That means, that Java is PLATFORM INDEPENDENT.

Is This Answer Correct ?    9 Yes 2 No

How java is platform independent?..

Answer / i.b kumar

Simply Platform = Hardware(Any Processor) + Operating System
When the Java compiler produces byte code that must run on Any Processor may be 16,32,64(bit) as well as any Operating System
and Byte code does that work.

So Java is called Platform Indepedendent.

Is This Answer Correct ?    4 Yes 0 No

How java is platform independent?..

Answer / 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

How java is platform independent?..

Answer / sandeep chauhan

the program is written in any language is called the source
program.and after compilation source code we get the object
code.so in java the source program is in ".java" file.when
this is compiled the object code will be in the ".class"
file.and this object code is bytecode.and this is is not
executable directly by any machine or o.s. so there will be
java virtual machine(jvm) which is an interpreter and
interpret the compiled object code into machine
understandable language.and which is executable for
machine.but every machine have its own jvm.and so this
bytecode can be executed in any machine according to there
jvm.so java is plateform independent language.

Is This Answer Correct ?    4 Yes 1 No

Post New Answer

More Core Java Interview Questions

What is the difference between Byte stream and Charecter Stream?

2 Answers   Tarang Software,


What is a Wrapper class?

14 Answers  


Why is java logo a cup of coffee?

0 Answers  


what is function overloading in java?

0 Answers   Tavant Technologies, TCS, Virtusa,


When we will use an Interface and Abstract class?

9 Answers  






What are the 4 types of research methods?

0 Answers  


What is static and final keyword in java?

0 Answers  


Which are the two subclasses under exception class?

0 Answers  


What is the meaning of 3 dots in java?

0 Answers  


what is difference between servletconfig and servletcontext?

3 Answers   Amdocs,


What is covariant return type?

0 Answers  


What are scriptlets?

0 Answers  


Categories