Q1. Why is Java called a platform-independent language?
Java is platform-independent because compiled Java code is converted into bytecode, which can run on any system having a JVM.
Q2. What happens internally when you compile a Java program?
The Java compiler converts source code (.java) into bytecode (.class), which is later executed by the JVM.
Q3. What is the difference between JDK, JRE, and JVM?
JVM executes bytecode, JRE provides runtime environment, and JDK includes JRE plus development tools like compiler and debugger.
Q4. How does JVM execute bytecode?
JVM loads bytecode, verifies it, and executes it using an interpreter or Just-In-Time (JIT) compiler.
Q5. Why is Java not 100% object-oriented?
Java is not 100% object-oriented because it supports primitive data types like int, char, and boolean.
Q6. What is the role of the class loader?
The class loader loads class files into memory dynamically when they are needed during execution.
Q7. Explain the Java execution flow step by step.
Java source code is compiled into bytecode, loaded by class loader, verified, and executed by the JVM.
Q8. What is bytecode and why is it important?
Bytecode is intermediate code generated by the Java compiler that enables platform-independent execution.
Q9. Why is Java considered secure?
Java is secure due to features like bytecode verification, sandbox execution, class loader isolation, and no direct memory access.
Q10. What are the main features of Java?
Key features of Java include platform independence, object-oriented design, security, robustness, multithreading, and high performance.