ALLInterview.com :: Home Page            
 Advertise your Business Here     
Browse  |   Placement Papers  |   Company  |   Code Snippets  |   Certifications  |   Visa Questions
Post Question  |   Post Answer  |   My Panel  |   Search  |   Articles  |   Topics  |   ERRORS new
   Refer this Site  Refer This Site to Your Friends  Site Map  Bookmark this Site  Set it as your HomePage  Contact Us     Login  |  Sign Up                      
Google
   
 
Categories >> Software >> Java Related >> Java J2EE >> Core Java
 
 


 

 
 Core Java interview questions  Core Java Interview Questions (1721)
 Advanced Java interview questions  Advanced Java Interview Questions (331)
 Swing interview questions  Swing Interview Questions (44)
 EJB interview questions  EJB Interview Questions (134)
 Servlets interview questions  Servlets Interview Questions (255)
 Struts interview questions  Struts Interview Questions (196)
 JDBC interview questions  JDBC Interview Questions (187)
 JMS interview questions  JMS Interview Questions (9)
 SunOne interview questions  SunOne Interview Questions (3)
 J2EE interview questions  J2EE Interview Questions (71)
 Weblogic interview questions  Weblogic Interview Questions (146)
 Websphere interview questions  Websphere Interview Questions (14)
 Java Networking interview questions  Java Networking Interview Questions (20)
 Java J2EE AllOther interview questions  Java J2EE AllOther Interview Questions (87)
Question
Why Java is a platform independent language?
 Question Submitted By :: Core-Java
I also faced this Question!!     Answer Posted By  
 
Answer
# 1
The compiler converts source code file into bytecode files. These codes are machine independent and can be run on any machine. Java interpreter reads the bytecode files and translates them into machine code for the specific machine on which the Java program in running. 
Is This Answer Correct ?    151 Yes 5 No
Nikhlesh Gupta Datia(m.p.)
 
Answer
# 2
platform independent means,the java compiled program can be
run on any operating system.because when you compile a
program you will get a class file which contains byte code
which is specific to java. that byte code can understand by
jvms (java virtual machines).for different operating
systems different jvms will be there.so the jvm will
convert the byte code into machine understandable code.so
as the jvm is different for different operating systems no
need to worry much,that will take care of explaining to the
os.ok.
 
Is This Answer Correct ?    91 Yes 5 No
Prapanch
 
 
 
Answer
# 3
Java solves the problem of platform-independence by using
byte code. The Java compiler does not produce native
executable code for a particular machine like a C compiler
would. Instead it produces a special format called byte
code. Java byte code written in hexadecimal, byte by byte,
looks like this:

CA FE BA BE 00 03 00 2D 00 3E 08 00 3B 08 00 01 08 00 20 08

This looks a lot like machine language, but unlike machine
language Java byte code is exactly the same on every
platform. This byte code fragment means the same thing on a
Solaris workstation as it does on a Macintosh PowerBook.
Java programs that have been compiled into byte code still
need an interpreter to execute them on any given platform.
The interpreter reads the byte code and translates it into
the native language of the host machine on the fly. The most
common such interpreter is Sun's program java (with a little
j). Since the byte code is completely platform independent,
only the interpreter and a few native libraries need to be
ported to get Java to run on a new computer or operating
system. The rest of the runtime environment including the
compiler and most of the class libraries are written in Java.

All these pieces, the javac compiler, the java interpreter,
the Java programming language, and more are collectively
referred to as Java.
 
Is This Answer Correct ?    111 Yes 26 No
Rani
 
Answer
# 4
One of the key reasons Java technology is useful in a
networked environment is that Java makes it possible to
create binary executables that will run unchanged on
multiple platforms. This is important in a networked
environment because networks usually interconnect many
different kinds of computers and devices. In a typical
enterprise environment, for example, a network might
connect Macintoshes in the art department, UNIX
workstations in engineering, and PCs running Windows
everywhere else. Although this arrangement enables various
kinds of computers and devices within the company to share
data, it requires a great deal of administration. Such a
network presents a system administrator with the task of
keeping different platform-specific editions of programs up
to date on many different kinds of computers. Programs that
can run without change on any networked computer,
regardless of the computer's type, make the system
administrator's job simpler, especially if those programs
can actually be delivered across the network.

 
Is This Answer Correct ?    24 Yes 7 No
Guest
 
Answer
# 5
Platform independent is nothing but write-once
Run-Anywhere.It means program can run on any Operating
System(OS).

compiler Interpreter
Java source code------->M/C code------->Linux or windows
javac JVM
Fig.

When you compile a source code by using javac compiler you
will get .class file which contains byte code.
that byte code can understand by JVM(Java Virtual Machine).
so, the JVM is different for different OS(operating system).
after that the JVM will convert the byte code(by using
interpreter) into machine understandable code i.e 1's & 0's.
Java is compiler as well as Interpreter Programming Language.
 
Is This Answer Correct ?    3 Yes 0 No
Shital Mhetre
 
Answer
# 6
This is because of the magic of Byte Code which is OS indepedent. When java compiler compile any code then it generate the byte code not the machine native code(unlike C compiler).Now this byte code need a interpreter to execute on a machine.This interpreter is JVM.So JVM read that byte code(that is machine indepedent) amd execute it. Different JVM is designed for different OS and byte code is able to run on different OS. 
Is This Answer Correct ?    2 Yes 0 No
Ashwani Maddeshiya
 

 
 
 
Other Core Java Interview Questions
 
  Question Asked @ Answers
 
what is abstract method with example? Virtusa 6
If set accepts only one argument then how can it compare two objects to avoid duplicates   5
What happens when a class is made static like if a field or member is made static it becomes class variable and is shared by all the object of the class?   1
What is compile time polymorphism? Elementus-Technologies 20
Difference between Hash Table and Hash Map? Persistent 10
difference between java ,c#&java,c++   3
Difference between an argument and a parameter? HCL 10
What are uses of Hash Code? Cognizent 2
what is platform dependent translation and platform dependent programming language   2
write the hierarchy of component class?   1
how to write a program for chat function using core java Satyam 1
what is the difference between applet and swing and gui application in java . What we do with the collections set and list interface Phoenix-Technologies 2
 
For more Core Java Interview Questions Click Here 
 
 
 
 
 


   
Copyright Policy  |  Terms of Service  |  Articles  |  Site Map  |  RSS Site Map  |  Contact Us
   
Copyright 2013  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  KalAajKal.com