ALL >> Computer-Programming >> View Article
Jvm Plays An Important Role In Execution Of Java Program
To write and execute a program we need the following
1) Editor– To type a program into, for example notepad,notepad++ etc.
2) Compiler – To convert high level language program into machine code
3) Linker – To combine different program files reference in your main program together.
4) Loader – To load the files from the secondary storage device like Hard Disk, Flash Drive , CD into RAM for execution. The loading is automatically done when we execute our code.
5) Execution – Actual execution of the program which is handled by OS(Operating System) & processor.
Java code compilation and execution :
 Once we write a program , we have to save with the class name.java.
Best core java training in bangalore
Once we execute a program .java file converts into .class file
JVM convert the .class file into machine code.
JVM divide the memory into stack and memory memory.
Then JVM call the class loader , class loader go back to the main class and find the all stack members and load into heap memory.
Again control go back to ...
... the JVM , it loads the all static members into stack.
Then it try to identifies the main method and start the execution.
If main method is not there , then it will through the error and execution will stop.
Once execution done JVM call garbage collector to clear the memory.
What is JVM ?
Java course in bangalore
JVM is known as Java Virtual Machine. It is the engine that executes the Java Code. It converts bytecode into machines code.
1) Java compiler produces code for a Virtual Machine.
2) JVM compiled java code into bytecode. This bytecode gets interpreted on machines
3) Between host system and Java source, Bytecode is an intermediate language.
4) JVM is responsible for allocating a memory space.
JVM Architecture :
Classloader is a subsystem of JVM which is used to load the class files into the memory.
 Class Area(Method Area):
Class Area stores per-class structures such as the runtime constant pool, fields and methods, code for methods. Java training center bangalore
Java Stack stores frames.It holds local variables and partial results, and plays a part in method invocation and return.
Each thread has a private JVM stack, created at the same time as thread.
A new frame is created each time a method is called. A frame is destroyed when its method call completes.
 Native Method Stack:
Native Method Stack contains all the native methods used in the application.
Heap is the runtime data area in which objects are allocated and stored.
 Program Counter Register:
PC (program counter) register contains the address of the Java virtual machine instruction currently being executed. Advance java training in bangalore
 Execution Engine :
Execution Engine contains :
i) A virtual processor
ii) Interpreter: Read bytecode stream then execute the instructions.
iii) Just-In-Time(JIT) compiler: It is used to improve the performance.JIT compiles parts of the byte code that have similar functionality at the same time, and hence reduces the amount of time needed for compilation.
Working of JVM:
The JVM performs following works :
1)Loads the java code
2)Verifies the code
3)Executes the code
4)Provides runtime environment
Java is both compiled and interpreted language :
Compiler : A compiler is a program which converts a program from one level of language to another. Example conversion of C++ program into machine code.
The java compiler converts high level java code into bytecode . Java/j2ee classes bangalore
Interpreter : A interpreter is a program which converts a program at one level to another programming language at the same level. In Java , the JVM converts the bytecode into the native machine code
Hence java is both compiled and interpreted interpreted language.
Author : Infocampus provides best core java training in bangalore with the live project. Learn OOPs concept, packages, Multithreading, Spring, Hibernate etc in the Core and Advance java classes .4 days free demo classes are provided for java course.
Join Infocampus Software Training Institute and get free placement assistance on java training.Mock test and Mock interview are conducted for the preparation of learners on java/j2ee classes. Java Training is available on flexible timing on weekdays and weekends.
To get the free demo classes contact at : 9738001024 or to get more details about the Advance Java Training enquire at :http://www.infocampus.co.in/java-training-bangalore.html
Computer Programming Articles1. Why Is My Epson Printer Only Printing Blank Pages?
Author: Gloria Jenkins
2. Top Back Office Service Provider
3. Tekosep It Service
4. Go ……go And Learn Go!!
Author: Dr. R. Lalitha, Professor, CSE, RIT
5. A Guide To Restore Deleted Photos On Your Android Smartphone
Author: ella johnson
6. React Native App Development Company
7. How Outsourcing Practices Are Changing In 2021
8. How To Fix Canon Printer Offline Issue Quickly?
Author: Carl Wood
9. Reset Your Forgotten Windows 10 Password
Author: ella johnson
10. Ux Web & Mobile Tips To Enhance Speed And Usability
Author: sahrukh hasan
11. Global Aton Management And Monitoring System Market
12. 3 Reasons You Should Consider A Mini Tower Gaming Pc
Author: Ahmed Abdelaziz
13. Photo Editing App: 9 Must-have Features
Author: Maulik Shah
14. Global Computer Graphics Market
15. Japan Organ Preservation Market
Author: Rupali Dagade