I have sat on both sides of the Java interview table. As a candidate, sweating over what “static” really means under pressure. And later, as someone reviewing fresher resumes and asking the exact same questions, candidates panic about it.
Here is the uncomfortable truth nobody tells freshers: most candidates fail not because they do not know Java. They fail because they memorized definitions without understanding the “why” behind them.
This guide fixes that. You will get core Java interview questions for freshers with answers written the way you should actually say them in an interview, not textbook copy-paste. We will also cover what interviewers are silently judging, common traps, and a few things almost no other guide tells you.
Java is not going away anytime soon either. It still holds the No. 3 spot on the TIOBE Index in 2026, sitting just behind Python and C, and ahead of C++. If you are worried Java is “outdated” for 2026 hiring, that worry is misplaced. Companies like TCS, Infosys, Wipro, and Cognizant are still actively hiring Java freshers in large numbers, especially candidates who pair Core Java with Spring Boot.
Let’s get into it.
How Fresher Java Interviews Actually Work
Most fresher interviews follow a predictable pattern: 5-8 minutes of Core Java basics, then a jump into OOP concepts, then a couple of tricky “gotcha” questions, and finally one or two coding problems on a whiteboard or shared screen.
Here’s what most candidates miss: interviewers are not testing if you memorized the JDK documentation. They are testing if you can explain a concept clearly enough that a non-technical person could follow your logic. That clarity matters more than perfect terminology.
Keep that in mind as you go through these answers. Don’t just memorize them. Understand why the answer is the answer.

Core Java Interview Questions for Freshers (The Fundamentals)
1. What is Java, and why is it called platform-independent?
Direct answer: Java is an object-oriented, class-based programming language designed to run on any device without needing to be rewritten. It achieves this through the JVM (Java Virtual Machine), which acts as a translator between your compiled code and the operating system.
When you compile Java code, it does not turn directly into machine code. It turns into bytecode, a universal format that any JVM, on any OS, can understand and execute. This is the actual mechanism behind “write once, run anywhere,” not just a marketing slogan.
Interview tip: If asked “how” it’s platform-independent, always mention bytecode and JVM specifically. Saying “because it just works everywhere” without explaining the mechanism is a common reason candidates lose points here.
2. What is the difference between JDK, JRE, and JVM?
Direct answer: JVM runs your code. JRE lets you run Java applications (JVM + libraries). JDK lets you build and run Java applications (JRE + compiler and dev tools).
| Component | What it contains | Who needs it |
|---|---|---|
| JVM | Executes bytecode | Anyone running Java applications |
| JRE | JVM + core libraries | End users running Java software |
| JDK | JRE + compiler (Javac) + development tools | Developers writing Java code |
Real-world note: Most freshers get this backward in panic mode. Remember the nesting: JDK contains JRE, which contains JVM. If you can draw that as three concentric circles in your head, you will never mix it up again.
3. What are the main differences between JDK and JRE?
Direct answer: JDK is for development (writing and compiling code). JRE is for execution only (running already-compiled code). If you only need to run a Java app, JRE is enough. If you need to write or compile Java code, you need the JDK.
4. Why is Java not 100% object-oriented?
Direct answer: Because Java still uses eight primitive data types (int, char, boolean, etc.) that are not objects. A fully object-oriented language would treat absolutely everything, including numbers, as objects.
This is a classic “gotcha” question. Many freshers confidently say “Java is 100% OOP” because that is what they assumed throughout their course. Pointing out primitives shows you actually understand the language at a deeper level than surface-level coursework.
5. What are the four pillars of OOP in Java?
Direct answer: Encapsulation, Inheritance, Polymorphism, and Abstraction.
- Encapsulation: Bundling data and methods together, restricting direct access using private/protected modifiers.
- Inheritance: One class acquiring the properties and behavior of another using “extends.”
- Polymorphism: One method behaving differently based on the object calling it (overloading and overriding).
- Abstraction: Hiding implementation details and showing only essential features via abstract classes or interfaces.
Common mistake: Candidates often confuse encapsulation with abstraction. Encapsulation is about data protection (the “how”). Abstraction is about hiding complexity (the “what”). Keep that distinction sharp.
6. What is the difference between method overloading and method overriding?
| Aspect | Overloading | Overriding |
|---|---|---|
| Definition | Same method name, different parameters | Same method signature in child class |
| Class involved | Same class | Parent and child class |
| Polymorphism type | Compile-time | Runtime |
| Return type | Can differ | Must be same or covariant |
Practical takeaway: If you remember nothing else, remember: overloading happens at compile time within one class, overriding happens at runtime across inherited classes.
7. What is a constructor in Java?
Direct answer: A constructor is a special method used to initialize objects. It has the same name as the class and no return type, not even void.
Java automatically provides a default no-argument constructor if you don’t write one yourself. But the moment you define any constructor manually, that default one disappears, which trips up a lot of freshers when their code suddenly breaks.
8. What is the difference between a constructor and a method?
Direct answer: A constructor initializes an object and has no return type. A method performs an action or computation and must have a return type (even if it’s void).
9. What is the “this” keyword used for?
Direct answer: “this” refers to the current object instance. It’s most commonly used to distinguish between instance variables and parameters with the same name.
class Student {
String name;
Student(String name) {
this.name = name; // 'this.name' is the instance variable, 'name' is the parameter
}
}
10. What is the “super” keyword used for?
Direct answer: “super” refers to the immediate parent class. It’s used to call a parent class’s constructor, methods, or access its variables when they’re hidden by the child class.
11. What is the difference between “==” and “.equals()” in Java?
Direct answer: “==” compares references (memory addresses) for objects, and actual values for primitives. “.equals()” compares the actual content/value of objects (when properly overridden).
This is one of the most commonly asked, and most commonly fumbled, questions in fresher interviews. Two String objects with the same text can be “==” false but “.equals()” true, because they exist as different objects in memory even though their content matches.
12. What is the String pool in Java?
Direct answer: The String pool (or String constant pool) is a special memory region in the heap where Java stores String literals to avoid creating duplicate objects for identical text.
When you write String a = "hello"; and String b = "hello";, both variables point to the same object in the pool. But String c = new String("hello"); forces a new object outside the pool. This is exactly why “==” can behave unexpectedly with Strings.
13. Why are Strings immutable in Java?
Direct answer: Strings are immutable for security, thread-safety, and to enable the String pool’s memory-saving behavior. Once created, a String’s value cannot change, any operation that looks like modification actually creates a new String object.
For ex-
String s = “Hello”;
s.concat(” World”);System.out.println(s);
o/p- Hello
Hidden reality: This is also why repeated string concatenation in a loop (using +) is a performance trap. Each concatenation creates a brand-new String object. For heavy concatenation, StringBuilder exists specifically to avoid this overhead.
14. What is the difference between String, StringBuilder, and StringBuffer?
| Class | Mutable? | Thread-safe? | When to use |
|---|---|---|---|
| String | No | Yes (because it’s immutable) | Fixed text, constants |
| StringBuilder | Yes | No | Single-threaded applications with frequent modifications |
| StringBuffer | Yes | Yes | Multi-threaded environments |
15. What are access modifiers in Java?
Direct answer: Access modifiers control the visibility of classes, methods, and variables. Java has four: private, default (no keyword), protected, and public.
- private: Accessible only within the same class.
- default: Accessible within the same package.
- protected: Accessible within the same package, plus subclasses in other packages.
- public: Accessible from anywhere.
16. What is the difference between an abstract class and an interface?
| Aspect | Abstract Class | Interface |
|---|---|---|
| Methods | Can have both abstract and concrete methods | Mostly abstract (default and static methods allowed since Java 8) |
| Variables | Can have any type of variable | public static final by default |
| Inheritance | Single inheritance (extends one class) | Multiple inheritance (implements multiple interfaces) |
| Constructor | Yes | No |
It depends situation: Use an abstract class when subclasses share common code and a clear “is-a” relationship. Use an interface when unrelated classes need to guarantee the same behavior (a “can-do” relationship).
17. What is the difference between checked and unchecked exceptions?
Direct answer: Checked exceptions are checked at compile time and must be either caught or declared (like IOException). Unchecked exceptions occur at runtime, and the compiler does not force you to handle them (like NullPointerException).
18. What is the difference between “throw” and “throws”?
Direct answer: “throw” is used to actually throw an exception instance inside a method. “throws” is used in a method signature to declare that a method might throw a certain exception type.
19. What is the finally block, and does it always execute?
Direct answer: The finally block contains cleanup code that runs regardless of whether an exception occurred. It almost always executes, except in a few edge cases.
Edge case interviewers love: finally will NOT execute if the JVM crashes, if you call System.exit() inside the try block, or if the thread running it is forcibly killed. Mentioning this exception shows depth beyond textbook answers.
20. What is the difference between an array and an ArrayList?
| Aspect | Array | ArrayList |
|---|---|---|
| Size | Fixed at creation | Dynamic, grows automatically |
| Data type | Stores primitives and objects | Stores objects only |
| Performance | Faster for fixed-size data | Slight overhead due to resizing |
| Built-in methods | Minimal | Rich API (add(), remove(), contains(), etc.) |
21. What is the difference between HashMap and HashTable?
Direct answer: HashMap is not thread-safe and allows one null key, while HashTable is thread-synchronized and does not allow null keys or values.
In modern Java development, HashTable is rarely used in new code. If you need thread safety, ConcurrentHashMap is the practical, modern choice. Mentioning this shows you know current best practices, not just legacy syllabus content.
22. What is the difference between List, Set, and Map?
- List: Ordered collection, allows duplicates (ArrayList, LinkedList).
- Set: Unordered collection, no duplicates allowed (HashSet, TreeSet).
- Map: Key-value pairs, keys are unique (HashMap, TreeMap).
23. What is the difference between final, finally, and finalize?
| Keyword | Purpose |
|---|---|
| Final | Makes a variable constant, a method non-overridable, or a class non-inheritable |
| Finally | Block that always executes after try-catch, typically used for cleanup |
| Finalize() | Deprecated method once called by the Garbage Collector before object destruction (avoid relying on it) |
24. What is garbage collection in Java?
Direct answer: Garbage collection is the automatic process by which the JVM identifies and removes objects that are no longer referenced, freeing up memory without manual intervention.
You can request garbage collection using System.gc(), but this is only a suggestion to the JVM, not a guarantee. The JVM decides when garbage collection actually runs.
25. What is the difference between stack and heap memory in Java?
| Aspect | Stack | Heap |
|---|---|---|
| Stores | Method calls, local variables | Objects, instance variables |
| Access speed | Faster | Slower |
| Memory management | Automatic (LIFO) | Managed by the Garbage Collector |
| Lifetime | Exists only during method execution | Until objects are no longer referenced |
26. What is the difference between static and instance variables?
Direct answer: Static variables belong to the class itself and are shared across all objects. Instance variables belong to each individual object, with their own separate copy.
27. Can you override a static method in Java?
Direct answer: No, static methods cannot be overridden, only hidden. Since static methods are resolved at compile time based on the reference type, not the actual object, what looks like “overriding” a static method is actually method hiding, a completely different mechanism.
This is a favorite trick question precisely because most fresher courses never explain it clearly.
28. What is the difference between a local variable and an instance variable?
Direct answer: Local variables are declared inside a method and only exist during that method’s execution. Instance variables are declared inside a class but outside any method, and they exist as long as the object exists.
29. What is multithreading, and why does Java support it?
Direct answer: Multithreading allows multiple parts of a program to run concurrently, improving performance for tasks like handling multiple user requests simultaneously. Java supports it natively through the Thread class and Runnable interface, which is one reason it became popular for server-side and enterprise applications.
30. What is the difference between Process and Thread?
Direct answer: A process is an independent program with its own memory space. A thread is a lightweight unit within a process that shares the same memory space as other threads in that process.
Myth vs Reality: What Fresher Java Candidates Get Wrong
Most prep guides repeat the same generic advice without checking if it’s actually true anymore. Here’s where popular advice and real interview practice diverge.
| The Myth | The Reality |
|---|---|
| “Memorize every collections method and you’ll pass.” | Interviewers care more about knowing when to use HashMap vs TreeMap than memorizing every method. Conceptual understanding matters more. |
| “Java is dying; don’t bother learning it deeply.” | Java continues to be one of the world’s most widely used programming languages, especially in banking, fintech, and enterprise backend development. |
| “You need to know design patterns as a fresher.” | Most fresher interviews focus far more on Core Java, OOP, exception handling, and collections than advanced design patterns. |
| “If you can write code on paper, you’re interview-ready.” | Many candidates can code but struggle to explain why their solution works. Interviewers often evaluate reasoning as much as correctness. |
| “Core Java alone gets you hired.” | Many entry-level Java roles also expect at least basic knowledge of Spring Boot because it is widely used in production applications. |
For Intermediate Readers: Where Fresher Knowledge Stops Being Enough
If you already know the answers above, here’s what separates a fresher from someone who gets fast-tracked to the next round.
Understanding “it depends” answers
Senior interviewers love asking, “When would you NOT use X?” Knowing ArrayList exists is a fresher level. Knowing that LinkedList beats ArrayList for frequent insertions/deletions in the middle of a list but loses badly on random access shows you understand trade-offs, not just definitions.
JVM internals beyond the basics
Knowing that Java has a JVM is a fresher level. Understanding generational garbage collection (young generation and old generation), how the JIT compiler optimizes frequently run code, and what happens during a “stop-the-world” GC pause is where intermediate-level conversations start.
Concurrency beyond “Java supports multithreading”
Knowing Thread exists is a fresher level. Understanding race conditions, the synchronized keyword’s actual cost, and why ConcurrentHashMap outperforms a synchronized HashMap under load is where real backend work begins.
Why Spring Boot changes the interview conversation
Core Java interviews increasingly assume baseline familiarity with how Spring Boot abstracts away boilerplate. Recruiters in cities with heavy enterprise IT presence are now explicitly testing Spring Boot, REST APIs, and Java Collections together rather than Core Java in isolation.
Sections Most Competing Guides Skip
What Recruiters Are Silently Scoring (Beyond Right/Wrong Answers)
Most guides only cover content. They ignore that recruiters score communication clarity, whether you ask clarifying questions before answering coding problems, and how you handle “I don’t know” moments.
What should be covered: How to say “I don’t know” without sounding unprepared, why pausing to think out loud helps more than rushing, why asking “should I assume this list is sorted?” before coding signals seniority beyond your experience level, and why explaining your thought process matters even on questions you get wrong.
Reader takeaway: Technical correctness alone does not get freshers hired. Interview behavior often outweighs a few missed answers.
Best format: Expert notes / checklist.
Top 10 Most Asked Java Interview Questions in 2026
| Rank | Question | Difficulty |
|---|---|---|
| 1 | OOP Pillars | Easy |
| 2 | JDK vs JVM vs JRE | Easy |
| 3 | == vs equals() | Easy |
| 4 | String Pool | Medium |
| 5 | HashMap vs Hashtable | Medium |
| 6 | Exception Handling | Medium |
| 7 | Static Keyword | Medium |
| 8 | Array vs ArrayList | Easy |
| 9 | Garbage Collection | Medium |
| 10 | Thread vs Process | Medium |
How Salary Expectations Realistically Map to Skill Level in 2026
Most guides avoid discussing money because it’s uncomfortable or hard to verify. But understanding realistic ranges helps freshers negotiate without over- or under-shooting.
What should be covered: Java freshers at IT services companies in India typically start around ₹3.5-5 LPA. Adding Spring Boot and REST API skills can push that to ₹5-7 LPA. Full-stack Java freshers (Spring Boot + React) can see ₹6-10 LPA depending on the company and city. Bangalore, Pune, and Hyderabad remain the strongest hubs for these roles.
Reader takeaway: Knowing realistic numbers prevents freshers from either underselling themselves or walking into negotiations with unrealistic expectations.
Best format: Table with ranges by skill combination.
The “Explain to a 10-Year-Old” Test Interviewers Secretly Use
Why competitors ignore it: It sounds too informal for a “technical” guide, so most SEO-driven content skips it entirely.
Why Google may reward it: It demonstrates genuine practical experience and adds a unique angle that’s hard to find in templated competitor content.
What should be covered: Many senior interviewers privately judge candidates on whether they can simplify complex answers. If you can explain polymorphism using a real-world analogy (a single remote control button doing different things depending on the device it’s pointed at) instead of jargon, you stand out immediately.
Reader takeaway: Practicing simple analogies for every concept in this list is one of the highest-leverage interview prep activities, and almost nobody does it.
Best format: Framework / practice exercise.
Why “I Don’t Know, But Here’s How I’d Find Out” Beats Guessing
Why competitors ignore it: It feels like soft advice rather than “technical content,” so it gets cut from keyword-focused articles.
Why Google may reward it: It reflects genuine first-hand interviewing experience (E-E-A-T) rather than scraped definitions.
What should be covered: Guessing wrong confidently damages trust more than admitting uncertainty. A structured “here’s how I’d debug or look this up” answer shows problem-solving skill even without the exact fact memorized. This applies heavily to obscure library methods or edge-case exceptions.
Reader takeaway: Confidence in your process matters more than confidence in every individual fact.
Best format: Expert notes.
Quick Checklist Before Your Interview
- Can you explain OOP’s four pillars using a simple real-world analogy, not textbook language?
- Can you explain the difference between == and .equals() without hesitating?
- Do you know why strings are immutable, not just that they are?
- Can you explain when you’d choose ArrayList over LinkedList, and vice versa?
- Are you comfortable saying “I’m not 100% sure, but here’s my reasoning” instead of guessing blindly?
- Do you know at least basic Spring Boot terminology, even if you haven’t built a full project with it?
Final Thoughts
Cracking a fresher Java interview isn’t about memorizing fifty definitions the night before. It’s about understanding the handful of concepts that come up again and again, deeply enough that you can explain them in your own words under pressure.
Go through this list once for content, then again purely for explanation practice. Say your answers out loud. That single habit catches more weak spots than silent reading ever will.
You’ve got this. Java has been around for three decades and is not disappearing from enterprise hiring anytime soon. Put in the practice, and the interview becomes a conversation, not an interrogation.
Discover more from GroWithMoney
Subscribe to get the latest posts sent to your email.


