GeekInterview.com
Series: Subject: Topic:
Question: 496 of 576

Explain working of Java Virtual Machine (JVM)

Asked by: Beena | Member Since Sep-2005 | Asked on: Sep 19th, 2005

View all questions by Beena   View all answers by Beena

Showing Answers 1 - 9 of 9 Answers
hikarthik21

Answered On : Sep 24th, 2005

View all answers by hikarthik21

 JVM is a optimized rich set of instruction which interpretate into bytecode given to JRE 

  
Login to rate this answer.
Devidas Sonawane

Answered On : Oct 19th, 2005

JVM first converts .java file into .class file by using Compiler (.class is nothig but bytecode file.) and Interpretor reads bytecodes that runtime is faster.

  
Login to rate this answer.
Mithun

Answered On : Feb 14th, 2006

JVM is an abstract computing machine like any other real computing machine which interpretes the byte code( .class file which contains virtual machine instructions ) to a machine dependent native code. The output of JVM ie the native code contains low level instructions which is easily understandable by the micro processors which process the native code to give the desire output.

  
Login to rate this answer.
rameshbabukm

Answered On : May 26th, 2007

View all answers by rameshbabukm

Hi,

I JVM doesnt convert .java to .class(byte code) its compiler related, but jvm does read this byte to machine code.

Yes  1 User has rated as useful.
  
Login to rate this answer.

if jvm work as interpreter then wht is use of compiler???plz explain

  
Login to rate this answer.
sampra

Answered On : Feb 14th, 2008

View all answers by sampra

JVM is the specificaion given by sun we can get it physically as JRE.its task is covert the sourse code to byte code , only jvm can understand the byte code

  
Login to rate this answer.
nuttyvarun

Answered On : Feb 19th, 2008

View all answers by nuttyvarun

A Java Virtual Machine (JVM) is a set of computer software programs and data structures which use a virtual machine model for the execution of other computer programs and scripts. The model used by a JVM accepts a form of computer intermediate language commonly referred to as Java bytecode. This language conceptually represents the instruction set of a stack-oriented, capability architecture.

Though Java Virtual Machines most often run Java (programming language) code, a JVM can also be used for other programming languages. JVMs can also be released by other companies beside Sun (the developer of Java) -- JVMs using the "Java" trademark may be developed by other companies as long as they adhere to the JVM specification published by Sun (and related contractual obligations).

Programs intended to run on a JVM must be compiled into a standardized portable binary format, which typically comes in the form of .class files. A program may consist of many classes in different files. For easier distribution of large programs, multiple class files may be packaged together in a .jar file (short for Java archive).

The JVM runtime executes .class or .jar files, emulating the JVM instruction set by interpreting it, or using a just-in-time compiler (JIT) such as Sun's HotSpot. JIT compiling, not interpreting, is used in most JVMs today to achieve greater speed. Like most virtual machines, the Java Virtual Machine has a stack-based architecture.

  
Login to rate this answer.
ramakrishnankt

Answered On : Apr 20th, 2009

View all answers by ramakrishnankt

* Creation of bytecode
* Verifying the byte code
* Linking the code withlibrary
* Maintaining garbage collection

  
Login to rate this answer.

Java Virtual Machine is the heart of entire java program execution process. It isresponsiblefor taking the .class file and converting each byte code instruction into the machine language instruction that can be executed by the microprocessor. Remember that java compiler is outside the JVM. So .class file is given to the JVM and JVM performs following functions:


First of all it loads the .class file into memory.

Then it verifies whether all the byte code instructions are proper or not.If it finds any instruction suspicious,the execution is rejected immediately.JVM uses Interpreter to verify the byte code.

If byte codes are proper then it allocatesnecessarymemory to execute the program.There are 5 types of memory which is allocated to the java program by the JVM
1 Method area
2 Heap memory
3 Java Stack
4 PC register
5 Native Method stack

JVM also helps in Garbage collection of the Object which are not referenced by any reference variable.



  
Login to rate this answer.

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

Related Open Questions

Ads

Connect

twitter fb Linkedin GPlus RSS

Ads

Interview Question

 Ask Interview Question?

 

Latest Questions

Interview & Career Tips

Get invaluable Interview and Career Tips delivered directly to your inbox. Get your news alert set up today, Once you confirm your Email subscription, you will be able to download Job Inteview Questions Ebook . Please contact me if you there is any issue with the download.