Memorising "polymorphism means many forms" will get you through the first question. The second: "show me an example where you'd actually use it": is where most freshers stall. Java interviews at TCS, Infosys, Wipro, and product companies all follow a similar arc: definitions first, then application, then edge cases you didn't expect. These 60 questions are the ones that actually show up, with answers shaped for out-loud explanation rather than written recitation.
OOP Fundamentals: Always Asked
1. What are the 4 pillars of OOP? Encapsulation (bundling data + methods), Inheritance (IS-A relationship), Polymorphism (many forms: compile-time vs runtime), Abstraction (hiding implementation details). Know concrete examples of each.
2. Difference between Abstraction and Encapsulation? Abstraction = hiding complexity (what). Encapsulation = hiding data (how). Abstract class/interface implements abstraction; private fields + getters/setters implement encapsulation.
3. What is method overloading vs overriding? Overloading: same method name, different parameters (compile-time polymorphism, same class). Overriding: same method signature in subclass (runtime polymorphism, inheritance required).
4. Can we override static methods in Java? No: static methods are resolved at compile time (method hiding, not overriding). This is a common trick question.
5. What is the difference between abstract class and interface? Abstract class: can have constructors, state, and partial implementation. Interface (Java 8+): default and static methods allowed; no state. A class can implement multiple interfaces but extend only one abstract class.
6. What is the diamond problem and how does Java solve it? When multiple inheritance leads to ambiguity in which parent's method is called. Java avoids it by not allowing multiple class inheritance; interfaces with default methods use explicit override to resolve conflicts.
Java Collections: Heavily Tested
7. ArrayList vs LinkedList: when to use which? ArrayList: O(1) random access, O(n) insert/delete in middle. LinkedList: O(1) insert/delete at head/tail, O(n) random access. Use ArrayList for most use cases; LinkedList when frequent head/tail insertions matter.
8. HashMap internal working? HashMap stores key-value pairs in an array of buckets. Keys are hashed to bucket indices. Collisions (same bucket, different keys) are handled with chaining (linked list) or, since Java 8, red-black tree when bucket size > 8. Load factor default 0.75: resize at 75% capacity.
9. HashMap vs Hashtable vs ConcurrentHashMap? Hashtable: thread-safe but synchronized on every method (slow). ConcurrentHashMap: thread-safe with segment-level locking (Java 7) or CAS operations (Java 8+): much faster. HashMap: not thread-safe.
10. What is the difference between Comparable and Comparator? Comparable: natural ordering, implemented by the class itself (compareTo()). Comparator: custom ordering, external class/lambda. Use Comparator when you don't control the class or need multiple sort orders.
Exception Handling & Memory
11. Checked vs unchecked exceptions? Checked: must be declared/handled at compile time (IOException, SQLException). Unchecked: RuntimeExceptions: NullPointerException, ArrayIndexOutOfBoundsException. Error: system-level (StackOverflowError, OutOfMemoryError).
12. What happens when you catch and swallow an exception? The program continues but the error is silently ignored: dangerous in production. Always log the exception at minimum; propagate it if the caller should handle it.
13. What is the finally block? Always executes after try/catch, even on exception or return (but NOT if System.exit() is called or JVM crashes). Use for resource cleanup (pre-Java 7); prefer try-with-resources (AutoCloseable) in modern code.
14. What is garbage collection? JVM automatically manages memory. Objects become eligible for GC when no references point to them. GC algorithms: Serial, Parallel, G1 (default from Java 9+), ZGC (low-latency). You can hint with System.gc() but can't force it.
Reading Java answers is not the same as saying them. HireStepX puts you in the mock interview format: you answer out loud, and the AI evaluates whether your explanation would satisfy a panel, not just whether the definition was technically correct.
Practice freeJava 8+ Features: Modern Fresher Questions
15. What are lambda expressions? Anonymous functions: syntax: (params) -> body. Enable functional programming in Java. Example: list.sort((a, b) -> a.compareTo(b)).
16. What are Streams? Functional pipeline for processing collections: filter → map → reduce → collect. Lazy evaluation: intermediate operations run only when terminal operation is called. Parallel streams use fork/join pool.
17. What is Optional? Wrapper class to avoid NullPointerException. Optional.of(), Optional.ofNullable(), Optional.empty(). Use .orElse(), .orElseThrow(), .ifPresent(). Don't use Optional as method parameter: use it as return type.
18. Default and static methods in interfaces? Java 8 allowed default methods (implementation in interface) to enable backward compatibility when adding new methods to existing interfaces. Static interface methods can be called without an instance.
Multithreading: Asked at Mid-Level Freshers
19. Thread vs Runnable vs Callable? The quick answer: Runnable's run() returns void, Callable's call() returns a value and can throw checked exceptions, Thread is the actual execution unit and takes either in its constructor. But what interviewers really want to know is when you'd choose each. Callable exists specifically because Runnable can't give you a result back: if you need to run something concurrently and act on the output, you need Callable and a Future.
20. What is the volatile keyword? It forces every thread to read the variable from main memory instead of its local CPU cache. This solves the visibility problem: thread A writes a value, thread B actually sees it: but it does not solve atomicity. If you're doing a compound operation like count++, volatile isn't enough because that's actually three operations (read, increment, write). For that, you want AtomicInteger or a synchronized block.
21. What is a deadlock? How do you prevent it? Two threads, each holding a lock the other needs, each waiting for the other to release it first. Neither does. Prevention comes down to discipline: always acquire locks in the same order across your codebase, and use tryLock with a timeout if you can't guarantee that. The deeper fix is to ask whether you need multiple locks at all: most deadlock situations are a design smell.
22. ExecutorService vs creating new Thread directly? Always prefer ExecutorService. Creating a new Thread() per task means you're spinning up and tearing down OS threads on demand, which is expensive, and you have no handle on the results. ExecutorService manages a pool, reuses threads, and returns a Future so you can retrieve results, handle exceptions, and cancel tasks. The only reason to reach for new Thread() directly is if you genuinely need a one-off background task with no lifecycle management: which is almost never.
Frequently asked questions
Explore more