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                      
tip   To Refer this Site to Your Friends   Click Here
Google
   
 
Categories  >>  Software  >>  Java Related  >>  Java J2EE  >>  Core Java
 
 


 

 
 Core Java interview questions  Core Java Interview Questions
 Advanced Java interview questions  Advanced Java Interview Questions
 Swing interview questions  Swing Interview Questions
 EJB interview questions  EJB Interview Questions
 Servlets interview questions  Servlets Interview Questions
 Struts interview questions  Struts Interview Questions
 JDBC interview questions  JDBC Interview Questions
 JMS interview questions  JMS Interview Questions
 SunOne interview questions  SunOne Interview Questions
 J2EE interview questions  J2EE Interview Questions
 Weblogic interview questions  Weblogic Interview Questions
 Websphere interview questions  Websphere Interview Questions
 Java Networking interview questions  Java Networking Interview Questions
 Java J2EE AllOther interview questions  Java J2EE AllOther Interview Questions
Question
Why Java is a platform independent language?
 Question Submitted By :: Balakrishna
I also faced this Question!!     Rank Answer Posted By  
 
  Re: Why Java is a platform independent language?
Answer
# 1
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 ?    99 Yes 26 No
Rani
 
  Re: Why Java is a platform independent language?
Answer
# 2
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 ?    138 Yes 4 No
Nikhlesh Gupta Datia(m.p.)
 
 
 
  Re: Why Java is a platform independent language?
Answer
# 3
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 ?    20 Yes 6 No
Guest
 
  Re: Why Java is a platform independent language?
Answer
# 4
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 ?    80 Yes 5 No
Prapanch
 

 
 
 
Other Core Java Interview Questions
 
  Question Asked @ Answers
 
what are the diffrences between interface and abstract class?  4
what is the difference between the "protected and default" modifiers?  8
What are the names of Component subclasses that support painting?  1
What Is Resource Leak?  2
What is CardLayout? Infosys1
What are field variable and local variable?  3
Difference between Encapsulation and Abstraction Fidelity4
how to handle http request in struts Polaris2
What are the steps to do connection pooling in weblogic? TCS1
java can provide security ,how can provide? IBM8
What are the similarities between an array and an ArrayList?  3
What is the Vector class?  3
 
For more Core Java Interview Questions Click Here 
 
 
 
 
 


   
Copyright Policy  |  Terms of Service  |  Help  |  Site Map 1  |  Articles  |  Site Map  |   Site Map  |  Contact Us interview questions urls   External Links 
   
Copyright © 2012  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  Forum9.com   ::  KalAajKal.com