Core Java Interview Q&A
1. What are the main features of Java?
Answer: Java is platform-independent, object-oriented, has built-in garbage collection, supports
multithreading, is secure, and has a rich API.
2. How does Java achieve platform independence?
Answer: Java compiles code into bytecode which is executed by the Java Virtual Machine (JVM).
Since JVMs are available for many platforms, the same bytecode can run anywhere.
3. What is the difference between JDK, JRE, and JVM?
Answer: JDK includes development tools, JRE includes libraries to run Java apps, and JVM
executes the bytecode.
4. What is the difference between an abstract class and an interface?
Answer: Abstract classes can have state and constructors. Interfaces define contracts and support
default/static methods from Java 8 onwards.