:: 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                      
Categories >> Software >> Java Related >> Java J2EE >> Core Java


 Core Java interview questions  Core Java Interview Questions (1722)
 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 (147)
 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)
Why Java is a platform independent language?
 Question Submitted By :: Core-Java
I also faced this Question!!     Answer Posted By  
# 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 ?    168 Yes 7 No
Nikhlesh Gupta Datia(m.p.)
# 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 the jvm will
convert the byte code into machine understandable
as the jvm is different for different operating systems no
need to worry much,that will take care of explaining to the
Is This Answer Correct ?    96 Yes 6 No
# 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 ?    112 Yes 27 No
# 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 ?    25 Yes 7 No
# 5
Platform independent is nothing but write-once
Run-Anywhere.It means program can run on any Operating

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

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
# 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 ?    3 Yes 0 No
Ashwani Maddeshiya

Other Core Java Interview Questions
  Question Asked @ Answers
What is the difference between a public and a non-public class?   2
what is mutability?which one is mutable String or StringBuffer?and why?give examples of each which shows the mutability of each String or StringBuffer IBM 4
In what type of containers, Border layout is a default layout?   3
What is operator?   3
whats the purposr of using serialization?   6
public class AboutStrings{ public static void main(String args[]){ String s1="hello"; String s2="hel"; String s3="lo"; String s4=s2+s3; //to know the hash codes of s1,s4. System.out.println(s1.hashCode()); System.out.println(s4.hashCode()); // these two s1 and s4 are having same hashcodes. if(s1==s4){ System.out.println("s1 and s4 are same."); }else System.out.println("s1 and s4 are not same."); } } Somebody told me that, == operator compares references of the objects. In the above example even though s1 and s4 are refering to same object(having same hash codes), it is printing s1 and s4 are not same. Can anybody explain in detail why it is behaving like this? Thanks in Advance RavuriVinod TCS 4
They had given one progam final HashMap hm=new HashMap(); public void show() { hm.put("name",value); } in this prg here the final hashtable value can be changed in put method,its the prg run? DNS 3
what is request processor? Virtusa 1
what is the difference between equals method and == Professional-Access 17
What is the purpose of having the concept of overloading? Ness-Technologies 6
What is the immediate parent class of the Applet class?   1
What is the use of static import ? Rolta 4
For more Core Java Interview Questions Click Here 

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