Search
  • +44-7459919437 (UK- WhatsApp & Direct Call) | +91-6383544892 (India - WhatsApp Only) | Email Id : vinothrwins@gmail.com
Vinoth Tech Solutions
  • Home
  • Selenium Java Online Training
  • Self Paced Video Course
    • Selenium Course Curriculum
    • Cypress Course Curriculum
    • Playwright Course Curriculum
  • Tutorials
  • Demo Sites
    • E-Commerce Demo Application
    • Practice Automation
      • Demo Page Healthcare
      • Registration Form
      • Transaction Details
      • DropDown
      • Mouse Event
      • Keyboard Events
      • Alert and Popup
      • Multiple Windows
      • iFrames
      • Wait WebElement
      • WebTable
  • FAQS
  • About Me & Feedback
    • Placed Students Feedback
    • Online Training Feedback
    • LinkedIn Profile
    • TechTalk
  • Free YouTube Courses
    • Python for Automation
    • Free QA Video Courses
      • Manual Testing
      • Java For Automation
      • Selenium Webdriver
      • TestNG
      • Cucumber BDD
      • UFT(QTP) Automation
    • Free Data Science Courses
      • Artificial Intelligence for Beginners
      • Python For A.I
      • Python Pandas
      • Python NumPy
      • Mathematics for A.I
  • Home
  • Selenium Java Online Training
  • Self Paced Video Course
    • Selenium Course Curriculum
    • Cypress Course Curriculum
    • Playwright Course Curriculum
  • Tutorials
  • Demo Sites
    • E-Commerce Demo Application
    • Practice Automation
      • Demo Page Healthcare
      • Registration Form
      • Transaction Details
      • DropDown
      • Mouse Event
      • Keyboard Events
      • Alert and Popup
      • Multiple Windows
      • iFrames
      • Wait WebElement
      • WebTable
  • FAQS
  • About Me & Feedback
    • Placed Students Feedback
    • Online Training Feedback
    • LinkedIn Profile
    • TechTalk
  • Free YouTube Courses
    • Python for Automation
    • Free QA Video Courses
      • Manual Testing
      • Java For Automation
      • Selenium Webdriver
      • TestNG
      • Cucumber BDD
      • UFT(QTP) Automation
    • Free Data Science Courses
      • Artificial Intelligence for Beginners
      • Python For A.I
      • Python Pandas
      • Python NumPy
      • Mathematics for A.I

Java For Automation

  • What is Java?
  • Why to Learn Java?
  • History of Java
  • Types of Java Applications
  • Naming Conventions
  • Hello World Program
  • Internal Details of Java program
  • What is Java JDK, JRE and JVM ?
  • What is Java Comments ?
  • What is Java Variable?
  • Variable Naming convention
  • Primitive Data Types
  • Non Primitive Data Types
  • Type Casting
  • Java Arithmetic Operators
  • Relational Operators
  • What is logical operators in Java? 
  • What is Assignment Operators in Java? 
  • What is Unary Operators in Java? 
  • What is Ternary Operators in Java?
  • What is Java Control Statements?
  • What are Decision Making statements?
  • What are looping statements?
  • What are Jump statements?
  • What is OOPS concept in Java?
  • Advantages of Java OOPs
  • What is Java Inheritance?
  • What is Java Constructor?
  • What is this keyword?
  • What is Polymorphism?
  • What is super keyword ?
  • What is final keyword? 
  • What are access modifiers?
  • What is Encapsulation? 
  • What is Abstraction? 
View Categories
  • Home
  • Tutorials
  • Java
  • Java For Automation
  • Internal Details of Java program

Internal Details of Java program

Internal Details of Java program

Understanding the internal details of a Java program involves knowing what happens during both compile time and run time. Here’s a detailed explanation of each phase:

Compile Time #

1. Source Code:

  • The developer writes the Java source code in .java files using a text editor or an Integrated Development Environment (IDE).

2. Compilation:

  • The Java compiler (javac) takes the .java files and compiles them into bytecode, which is stored in .class files.
  • Syntax Checking: The compiler checks the source code for syntax errors. If any errors are found, the compilation process stops, and error messages are displayed.
  • Semantic Analysis: The compiler checks for semantic errors such as type checking and ensures that variable and method declarations are correct.
  • Bytecode Generation: If there are no errors, the compiler converts the source code into bytecode. Bytecode is an intermediate representation that is platform-independent.

Run Time #

1. Class Loading:

  • When a Java program is run, the Java Virtual Machine (JVM) starts. The JVM is responsible for loading, verifying, and executing the bytecode.
  • ClassLoader: The JVM uses a class loader to load the .class files into memory. This includes loading the main class that contains the main method.
  • Bootstrap ClassLoader: Loads core Java libraries located in the <JAVA_HOME>/lib directory.
  • Extensions ClassLoader: Loads classes from the <JAVA_HOME>/lib/ext directory.
  • Application ClassLoader: Loads classes from the application’s classpath.

2. Bytecode Verification:

  • The JVM verifies the bytecode to ensure it adheres to the Java language specifications and is safe to execute. This includes checking for stack overflows, illegal data conversions, and other security issues.

3. Just-In-Time (JIT) Compilation:

  • The JVM uses a Just-In-Time (JIT) compiler to translate bytecode into native machine code. This step is done at run time to optimize performance.
  • Interpretation: Initially, the JVM interprets the bytecode line by line.
  • Compilation: Frequently executed bytecode is compiled into native code by the JIT compiler, which improves execution speed.

4. Execution:

  • The JVM executes the native machine code on the host machine. This includes executing the main method and any other methods that are called during the program’s execution.
  • Garbage Collection: The JVM manages memory automatically through garbage collection, which identifies and removes objects that are no longer in use.

Example: “Hello, World!” Program #

public class HelloWorld {
    public static void main(String[] args) {
        System.out.println("Hello, World!");
    }
}

Compile Time Details #

  1. Source Code: HelloWorld.java contains the source code.
  2. Compilation Command: javac HelloWorld.java
  3. Output: HelloWorld.class containing bytecode.

Run Time Details #

  1. Class Loading: The JVM loads HelloWorld.class.
  2. Bytecode Verification: The JVM verifies the bytecode for safety.
  3. JIT Compilation: The JVM compiles frequently used bytecode into native code.
  4. Execution: The main method is executed, printing “Hello, World!” to the console.
  5. Garbage Collection: The JVM manages memory and collects garbage during execution.

Summary of Compile Time and Run Time Processes

PhaseProcess
Compile Time– Source code written in .java files.
– Java compiler (javac) checks for syntax and semantic errors.
– Bytecode is generated and stored in .class files.
Run Time– JVM starts and uses ClassLoader to load .class files.
– Bytecode is verified for safety and correctness.
– JIT compiler converts bytecode to native machine code for frequently executed parts.
– Native code is executed by the JVM.
– Garbage Collector manages memory.

Understanding these internal processes helps developers write efficient, error-free Java programs and optimize performance during execution.
Java
What are your Feelings
Share This Article :
  • Facebook
  • X
  • LinkedIn
Hello World ProgramWhat is Java JDK, JRE and JVM ?
Table of Contents
  • Compile Time
  • Run Time
  • Example: "Hello, World!" Program
    • Compile Time Details
    • Run Time Details
© 2018 – 2025 Vinoth Tech Solutions Ltd (UK), Reg. No: 16489105