Skip to content
DevOps with Multi Cloud: new batch 25 Nov
novarynit: Training, Placement, Consulting

10 questions

Java interview questions and answers

Core Java questions asked in fresher and junior developer interviews: OOP, collections, exceptions and the JVM.

What is the difference between JDK, JRE and JVM?
The JVM runs Java bytecode. The JRE is the JVM plus the standard libraries needed to run programs. The JDK is the JRE plus development tools such as the compiler (javac) and debugger.
What are the four pillars of object-oriented programming?
Encapsulation (keeping data and the methods that use it together, hiding internals), inheritance (a class reusing another class), polymorphism (one interface, many implementations) and abstraction (showing only what is essential).
What is the difference between == and equals()?
== compares references for objects, so it is true only when both variables point to the same object. equals() compares content when the class overrides it, as String does.
Why are Strings immutable in Java?
Immutability makes Strings safe to share between threads, lets the JVM reuse literals in the string pool, and keeps hash codes stable so Strings work reliably as map keys.
What is the difference between ArrayList and LinkedList?
ArrayList is backed by an array: fast random access, slower inserts in the middle. LinkedList is a chain of nodes: fast inserts and removals at the ends, slow random access.
How does HashMap work internally?
It stores entries in an array of buckets. The key’s hashCode() chooses the bucket and equals() finds the exact key inside it. Buckets with many collisions turn from a linked list into a balanced tree.
What is the difference between checked and unchecked exceptions?
Checked exceptions (such as IOException) must be caught or declared; the compiler enforces it. Unchecked exceptions extend RuntimeException (such as NullPointerException) and usually signal programming errors.
What is the difference between an abstract class and an interface?
An abstract class can hold state and constructors and a class can extend only one. An interface defines a contract, a class can implement many, and since Java 8 it can have default and static methods.
What is the difference between final, finally and finalize?
final makes a variable constant, a method non-overridable or a class non-extendable. finally is the block that always runs after try/catch. finalize() was a cleanup hook called by the garbage collector and is now deprecated.
What are streams in Java 8?
A stream is a pipeline for processing collections declaratively with operations such as filter, map and collect. Streams do not store data and intermediate operations are lazy.

More topics

Next step

Practise these in a mock interview

Sit in a free demo class first. We will call you back in 5 minutes

  • See a live class before you join
  • Meet the trainer and review the syllabus
  • Get a batch and timing that fits you
  • Ask about EMI and placement support

Where to learn

  • Ameerpet, Hyderabad

    3rd Floor, Green House, Ameerpet, Hyderabad, Telangana

  • Live online

    Join the same class from anywhere, ask questions live and get the same project reviews.

Request your free demo

Takes 30 seconds. No payment needed.

+91

Free · no obligation

Book your free demo class

Leave your number and we will call you back.

  1. We will call you back in 5 minutes
  2. Attend a free demo class
  3. Join only if you like it