Skip to content
NotesCore Java Interview QuestionsVerifyPDF

Core Java Interview Questions

  1. Why is Java platform-independent?

    Java compiles to bytecode that a compatible JVM can execute across operating systems.

  2. What is JIT compilation?

    The JVM can compile frequently executed bytecode into native machine instructions at runtime.

  3. Overloading vs overriding?

    Overloading selects among different parameter signatures at compile time. Overriding enables runtime dispatch of instance methods.

  4. Abstract class vs interface?

    Abstract classes support instance state and constructors. Interfaces define contracts and can also include default, static and private methods.

  5. Checked vs unchecked exceptions?

    Checked exceptions must generally be caught or declared. Unchecked exceptions do not have that requirement.

  6. How does synchronization work?

    Java monitors coordinate access to shared state and provide memory visibility guarantees.

  7. What are the main collection types?

    Lists represent sequences, sets enforce uniqueness, and maps associate keys with values.

  8. HashMap vs ConcurrentHashMap?

    ConcurrentHashMap supports concurrent access; HashMap does not provide thread safety.

  9. How does Java pass arguments?

    Always by value, including copies of object references.

  10. What is serialization?

    Conversion of object state into a representation suitable for storage or transmission. Never deserialize untrusted native Java serialized data.

Example

interface Shape {
    double area();
}
 
record Circle(double radius) implements Shape {
    public double area() {
        return Math.PI * radius * radius;
    }
}

Reference

Java Core Interview Questions & Answers and 240 Core Java Interview Questions and Answers (uploaded PDFs).