Java Interview Questions & Answers
Prepared for Interview Preparation
Date: 2025
Table of Contents
1. Introduction
2. Core Java Questions
3. OOPs in Java
4. Advanced Java Questions
5. Summary & Practice Questions
Introduction
This document provides a collection of important Java interview questions and answers.
It covers basic to advanced concepts in Java, making it useful for freshers and experienced
professionals.
Core Java Questions
Q1: What is Java?
A1: Java is a high-level, class-based, object-oriented programming language designed to have as
few implementation dependencies as possible. It is platform-independent due to its use of the JVM
(Java Virtual Machine).
Q2: What are the features of Java?
A2: Key features include Object-Oriented, Platform-Independent, Simple, Secure, Robust,
Multithreaded, High Performance, and Distributed.
Q3: Difference between JDK, JRE, and JVM?
A3: JVM (Java Virtual Machine) executes Java bytecode. JRE (Java Runtime Environment)
provides libraries and JVM to run Java applications. JDK (Java Development Kit) includes JRE +
development tools (compiler, debugger).
Q4: What is the difference between ArrayList and LinkedList?
A4: ArrayList uses dynamic arrays for storage, allows fast random access but slow
insertions/deletions. LinkedList uses doubly-linked nodes, making insertions/deletions faster but
random access slower.
OOPs in Java
Q5: Explain the four pillars of OOPs in Java.
A5: Encapsulation, Inheritance, Polymorphism, and Abstraction.
Q6: What is the difference between method overloading and overriding?
A6: Overloading: Same method name but different parameter lists (compile-time polymorphism).
Overriding: Redefining a parent class method in the child class (runtime polymorphism).
Advanced Java Questions
Q7: What are Java Streams?
A7: Streams are used in Java 8+ to process collections of data in a functional programming style.
They support operations like map, filter, reduce, and parallel processing.
Q8: What is the difference between HashMap and Hashtable?
A8: HashMap is non-synchronized, allows one null key and multiple null values, and is faster.
Hashtable is synchronized, does not allow null keys/values, and is slower.
Q9: Explain Garbage Collection in Java.
A9: Garbage Collection (GC) is an automatic memory management feature that reclaims memory
by destroying unused objects. JVM uses algorithms like Mark-Sweep and Generational GC.
Summary & Practice Questions
Summary: Java is a versatile, object-oriented, and platform-independent language widely used for
web, mobile, and enterprise applications. Interview questions often test core concepts, OOPs
principles, collections, and Java 8+ features.
Sample Practice Questions:
• Explain difference between Interface and Abstract class.
• What are Checked and Unchecked exceptions in Java?
• Describe the Java Memory Model and ClassLoader mechanism.
• What is the use of the 'volatile' keyword in Java?