Showing posts with label Garbage Collectors. Show all posts
Showing posts with label Garbage Collectors. Show all posts

April 06, 2016

#Java: Part 9-Core Java Interview Questions and Answers(Java Memory Model, Garbage Collectors in Java)

> > Part 7-Core Java Interview Questions and Answers

What is JIT compiler in Java?
  • JIT stands for Just-In-Time compiler. 
  • It is a program that helps in converting the Java bytecode into instructions that are sent directly to the processor. 
  • The JIT compiler is by default enabled and is activated whenever a Java method is invoked. The JIT compiler then compiles the bytecode of the invoked method into native machine code, compiling it 'just in time' to execute. 
  • Once the method has been compiled, the JVM summons the compiled code of that method directly rather than interpreting it. This is why it is often responsible for the performance optimization of Java applications at the run time.
Which are the different segments of memory ?
  • Stack Segment : contains local variables and Reference variables(variables that hold the address of an object in the heap)
  • Heap Segment : contains all created objects in runtime, objects only plus their object attributes (instance variables)
  • Code Segment :  The segment where the actual compiled Java bytecodes resides when loaded.