Java Interview Q&A: Quick Guide

Basic Java Interview Q&A – Quick Guide ✅ 1. What is Java? Java is a high-level, object-oriented, platform-independent programming language. Its “Write Once, Run Anywhere” capability comes from the JVM (Java Virtual Machine). ✅ 2. What are the features of Java? Simple & Secure Object-Oriented Platform Independent (via JVM) Robust & Multithreaded High Performance (JIT Compiler) ✅ 3. Difference between JDK, JRE, and JVM? JDK (Java Development Kit) → Tools for developing Java apps (compiler, debugger, JRE) JRE (Java Runtime Environment) → Runtime environment (JVM + libraries) JVM (Java Virtual Machine) → Executes Java bytecode, platform-dependent ✅ 4. What are OOP principles in Java? Encapsulation → Data hiding via classes Inheritance → Reusing properties/methods Polymorphism → Many forms (overloading/overriding) Abstraction → Hiding implementation details ✅ 5. Difference between == and equals()? == → Compares memory references equals() → Compares values/content ✅ 6. What is String immutability in Java? Once created, a String object cannot be changed. Any modification creates a new object in the String pool. ✅ 7. What is the difference between Array and ArrayList? Array → Fixed size, stores primitives & objects ArrayList → Dynamic size, stores only objects, part of the Collections framework ✅ 8. What are access modifiers in Java? public → Accessible everywhere protected → Within package + subclasses default → Within same package private → Within same class only ✅ 9. What is Exception Handling? A mechanism to handle runtime errors using keywords: try, catch, finally, throw, throws ✅ 10. Difference between Checked & Unchecked Exceptions? Checked → Compile-time (e.g., IOException, SQLException) Unchecked → Runtime (e.g., NullPointerException, ArithmeticException) ✅ 11. What is Garbage Collection in Java? Automatic memory management that removes unused objects from the heap. ✅ 12. What is the difference between Overloading and Overriding? Overloading → Same method name, different parameters (Compile-time polymorphism) Overriding → Subclass redefines parent method (Runtime polymorphism) #Java #JavaInterview #CoreJava #BackendDevelopment #OOP #JavaBasics #100DaysOfCode #CodingInterview #Programming #SoftwareEngineering

To view or add a comment, sign in

Explore content categories