0% found this document useful (0 votes)
6 views3 pages

Internal Detail or Working of Java Program

The document explains the internal workings of a Java program, detailing the compilation and runtime processes. During compilation, Java code is converted into bytecode by the Java Compiler, while at runtime, the Classloader, Bytecode Verifier, and Interpreter play key roles. It also addresses common questions regarding naming conventions and the inclusion of multiple classes in a Java source file.

Uploaded by

Anima
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views3 pages

Internal Detail or Working of Java Program

The document explains the internal workings of a Java program, detailing the compilation and runtime processes. During compilation, Java code is converted into bytecode by the Java Compiler, while at runtime, the Classloader, Bytecode Verifier, and Interpreter play key roles. It also addresses common questions regarding naming conventions and the inclusion of multiple classes in a Java source file.

Uploaded by

Anima
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

7/20/23, 11:10 PM Internal Detail or working of Java Program - javatpoint

Internal Details of Hello Java Program


In the previous section, we have created Java Hello World program and learn how to compile
and run a Java program. In this section, we are going to learn, what happens while we compile
and run the Java program. Moreover, we will see some questions based on the first program.

What happens at compile time?


At compile time, the Java file is compiled by Java Compiler (It does not interact with OS) and
converts the Java code into bytecode.

What happens at runtime?


At runtime, the following steps are performed:

Advertisement

https://www.javatpoint.com/internal-details-of-hello-java-program 2/7
7/20/23, 11:10 PM Internal Detail or working of Java Program - javatpoint

Classloader: It is the subsystem of JVM that is used to load class files.

Bytecode Verifier: Checks the code fragments for illegal code that can violate access rights to
objects.

Interpreter: Read bytecode stream then execute the instructions.

Q) Can you save a Java source file by another name than the class
name?

Yes, if the class is not public. It is explained in the figure given below:

Advertisement

To compile:
javac Hard.java

https://www.javatpoint.com/internal-details-of-hello-java-program 3/7
7/20/23, 11:10 PM Internal Detail or working of Java Program - javatpoint

To execute:
java Simple

Observe that, we have compiled the code with file name but running the program with class
name. Therefore, we can save a Java program other than class name.

Q) Can you have multiple classes in a java source file?

Yes, like the figure given below illustrates:

← Prev Next →

Youtube For Videos Join Our Youtube Channel: Join Now

Feedback Advertisement

Send your Feedback to [email protected]

https://www.javatpoint.com/internal-details-of-hello-java-program 4/7

You might also like