Professional Documents
Culture Documents
Deep Explanation of Java Program Compilation & Execution: Smart Programming
Deep Explanation of Java Program Compilation & Execution: Smart Programming
1
Smart Programming (Mohali, Chandigarh India)
Call or Whats App Online & Industrial Training: +91 62838-30308
2
Smart Programming (Mohali, Chandigarh India)
Call or Whats App Online & Industrial Training: +91 62838-30308
3
Smart Programming (Mohali, Chandigarh India)
Call or Whats App Online & Industrial Training: +91 62838-30308
6
Smart Programming (Mohali, Chandigarh India)
Call or Whats App Online & Industrial Training: +91 62838-30308
7
Smart Programming (Mohali, Chandigarh India)
Call or Whats App Online & Industrial Training: +91 62838-30308
3. Methods information.
4. Variables information.
5. Constructors information.
6. Modifiers information.
7. Constant pool information etc...
9
Smart Programming (Mohali, Chandigarh India)
Call or Whats App Online & Industrial Training: +91 62838-30308
2. Memory Areas :-
Below are the memory areas in JVM.
1. Method Area :-
Method area is created when JVM is
started.
It stores .class file information and static
variables.
10
Smart Programming (Mohali, Chandigarh India)
Call or Whats App Online & Industrial Training: +91 62838-30308
2. Heap Area :-
Heap area is created when JVM is started.
It stores objects, instance variables and
arrays (as every arrays is an object in java).
It can be accessed by multiple threads, so
the data stored in heap area is not thread safe.
3. Stack Area :-
Whenever a new thread is created, a
separate stack area will also be created.
It stores the current running method and
local variables.
When the method is completed, the
corresponding entry from the stack will be
removed.
11
Smart Programming (Mohali, Chandigarh India)
Call or Whats App Online & Industrial Training: +91 62838-30308
4. PC Register Area :-
It holds the address of next executing
instruction.
For every thread, a separate pc register is
created, so it is also thread safe.
12
Smart Programming (Mohali, Chandigarh India)
Call or Whats App Online & Industrial Training: +91 62838-30308
3. Execution Engine :-
Below is an architecture of execution engine in
JVM.
13
Smart Programming (Mohali, Chandigarh India)
Call or Whats App Online & Industrial Training: +91 62838-30308
14
Smart Programming (Mohali, Chandigarh India)
Call or Whats App Online & Industrial Training: +91 62838-30308
15
Smart Programming (Mohali, Chandigarh India)
Call or Whats App Online & Industrial Training: +91 62838-30308
16
Smart Programming (Mohali, Chandigarh India)
Call or Whats App Online & Industrial Training: +91 62838-30308
Interview Questions :-
=> What is the role of compiler ? OR
=> What happens in java compilation phase ?
1. Compiler checks the syntax whether it is
correct or not (whether the class, methods,
interfaces, variable declaration etc is correct or not,
Java is case sensitive language thus it checks upper
case and lower case keywords names)
2. Java is strongly typed language thus compiler
checks whether the variables has stored correct
value or not
3. Compiler ignores all the comments
4. Compiler generates the byte code
17
Smart Programming (Mohali, Chandigarh India)
Call or Whats App Online & Industrial Training: +91 62838-30308
18
Smart Programming (Mohali, Chandigarh India)
Call or Whats App Online & Industrial Training: +91 62838-30308
19
Smart Programming (Mohali, Chandigarh India)
Call or Whats App Online & Industrial Training: +91 62838-30308
20
Smart Programming (Mohali, Chandigarh India)
Call or Whats App Online & Industrial Training: +91 62838-30308
Websites: https://www.smartprogramming.in/
https://courses.smartprogramming.in
Android App:
https://play.google.com/store/apps/details?id=com.sma
rtprogramming
YouTube Channel:
https://www.youtube.com/c/SmartProgramming
21