Program Internal — Java Technical Interview Questions & Answers
Program Internal
Program Internal
- You write a .java file in plain text. javac compiles it into a .class file. That file holds bytecode, not a Windows .exe. Bytecode is for the JVM, not for one operating system.
- When you run the program, ClassLoader brings the .class into the JVM. A verifier checks it is not unsafe. Then JVM starts at main. Often JIT makes hot parts faster after they run many times.
- Remember the chain and say it out loud: .java → javac → .class → JVM → output. Same .class can run on another OS if JVM is installed.
- Let's take this on the board with one tiny Main class — no extra files. Program Internal — reads JVM properties — proves your runtime is available. Start from main, go line by line, and stop at each print. That output is the proof for Program Internal.
Main.java
│ javac
▼
Main.class (bytecode)
│ ClassLoader + verifier
▼
JVM → main()
│ JIT (hot code faster)
▼
outputTechnical Interview Tip: Say the chain: source → bytecode → JVM → run. Then add: not an .exe.
Code Examples for Program Internal
Example
// JVM / runtime info
public class Main {
public static void main(String[] args) {
System.out.println("java.version = " + System.getProperty("java.version"));
System.out.println("java.home = " + System.getProperty("java.home"));
System.out.println("os.name = " + System.getProperty("os.name"));
}
}Program Internal — reads JVM properties — proves your runtime is available.
How to Explain Program Internal to an Interviewer
What does javac produce?
.class file Bytecode
Who runs bytecode?
JVM
Is a .class an .exe?
No It runs on any OS with JVM