Core Java Interview Questions for Freshers (2026)

What core Java questions are asked to freshers? Interviewers usually start with JDK vs JRE vs JVM, then move to the four OOP pillars, String immutability, == vs equals(), ArrayList vs LinkedList, how HashMap works, exception handling, basic multithreading and Java 8 features such as lambdas and streams. They often finish with a small coding task. If you can answer each with a short definition plus a tiny code example, you cover most first-round Java interviews.
This guide from VibrantMinds Technologies in Pune gives 60+ core Java interview questions and answers, with code, comparison tables, output puzzles, trap questions and a 14-day plan. It is written for anyone searching core Java interview questions for freshers, Java interview questions for freshers, core Java interview questions and answers, JDK vs JRE vs JVM, difference between == and equals() in Java, Java OOP interview questions, Java collections interview questions, Java 8 interview questions for freshers, Java multithreading interview questions for beginners or a Java WhatsApp group for freshers in Pune.
Java evolves, and interviewers differ by company. Answers here are for general fresher interviews. This guide avoids salary figures and unverified statistics.
Takeaway | Detail |
|---|---|
Define, then demonstrate | One-line definition, then a 3 to 5 line code example. |
Four topics decide most rounds | OOP, Strings, Collections, Exception handling. |
Know the “difference between” questions | Interviewers love comparisons such as ArrayList vs LinkedList. |
Understand HashMap | It is the most asked collection question. |
Basics of threads and Java 8 are expected | Not deep expertise, but clear fundamentals. |
Say “I don’t know, but I would check...” honestly | It beats a wrong confident answer. |
HOW A CORE JAVA INTERVIEW USUALLY FLOWS
MODULE 1: JAVA BASICS AND THE JVM (Q1 TO Q10)
Q1. What are the main features of Java?
Answer: Object-oriented, platform independent (write once, run anywhere), secure, robust (strong memory management and exception handling), multithreaded and automatically garbage collected.
Q2. How is Java platform independent?
Answer: Java source code compiles into bytecode, which any machine with a JVM can run. The bytecode is the same, while the JVM is platform specific.
Q3. JDK vs JRE vs JVM
Term | Meaning |
|---|---|
JVM | Java Virtual Machine, executes bytecode |
JRE | JVM plus libraries needed to run Java programs |
JDK | JRE plus development tools such as the compiler ( |
Q4. What is bytecode?
Answer: The intermediate, machine-independent code produced by the Java compiler and stored in .class files.
Q5. What are the primitive data types in Java?
Answer: byte, short, int, long, float, double, char and boolean.
Q6. Primitive vs wrapper classes?
Answer: Primitives hold plain values (int). Wrapper classes (Integer) are objects that allow use in collections and provide utility methods. Autoboxing converts primitive to wrapper automatically, and unboxing does the reverse.
Q7. What does the static keyword do?
Answer: A static member belongs to the class, not to an object. It is shared by all instances and can be accessed without creating an object.
Q8. What does final mean?
Answer: A final variable cannot be reassigned, a final method cannot be overridden and a final class cannot be extended.
Q9. Why is main declared public static void main(String[] args)?
Answer: public so the JVM can access it, static so it can run without creating an object, void because it returns nothing and String[] args holds command-line arguments.
Q10. What is the difference between stack and heap memory?
Answer: Stack stores method calls and local variables, and is cleared when a method finishes. Heap stores objects and is managed by the garbage collector.
MODULE 2: OOP CONCEPTS (Q11 TO Q22)
Q11. What are the four pillars of OOP?
Pillar | One-line meaning | Java example |
|---|---|---|
Encapsulation | Hide data and expose it through methods | private fields with getters and setters |
Inheritance | A class reuses another class’s features |
|
Polymorphism | One interface, many behaviours | overloading and overriding |
Abstraction | Show essentials, hide details | abstract classes and interfaces |
Q12. What is a class and an object?
Answer: A class is a blueprint. An object is an instance of that class created with new.
Q13. What is a constructor? Can it be overloaded?
Answer: A special method that initialises an object and has the same name as the class and no return type. Yes, constructors can be overloaded. If you write none, Java provides a default constructor.
Q14. Method overloading vs overriding
Point | Overloading | Overriding |
|---|---|---|
Where | Same class | Parent and child class |
Signature | Different parameters | Same signature |
Binding | Compile time | Runtime |
Type | Compile-time polymorphism | Runtime polymorphism |
java
Q15. Abstract class vs interface
Point | Abstract class | Interface |
|---|---|---|
Methods | Abstract and concrete | Abstract, plus default and static (Java 8+) |
Variables | Any kind | public static final constants |
Inheritance | A class extends only one | A class can implement many |
Constructor | Yes | No |
Q16. Does Java support multiple inheritance?
Answer: Not with classes, to avoid the diamond problem. It is achieved through multiple interfaces.
Q17. What is the super keyword?
Answer: It refers to the parent class, used to call the parent constructor super(...), parent methods or parent fields.
Q18. What is the this keyword?
Answer: It refers to the current object, often used to separate instance variables from parameters.
Q19. What is encapsulation in practice?
java
Q20. Can we override a static or private method?
Answer: No. Static methods can be hidden but not overridden, and private methods are not inherited.
Q21. What is an immutable class and how do you create one?
Answer: A class whose objects cannot change after creation. Make the class final, fields private final, provide no setters and copy mutable fields defensively.
Q22. What is the difference between composition and inheritance?
Answer: Inheritance is an “is-a” relationship (Dog is an Animal). Composition is “has-a” (Car has an Engine). Composition is often more flexible and preferred when inheritance isn’t a natural fit.
MODULE 3: STRINGS (Q23 TO Q30)
Q23. Why is String immutable in Java?
Answer: Once created, a String’s value can’t change. This enables the String pool to safely share objects, makes Strings thread safe, supports caching of hash codes and improves security when Strings are used for things like file paths or connection details.
Q24. What is the String pool?
Answer: A special area of the heap where Java stores string literals so identical literals share one object.
Q25. == vs equals() for Strings
java
== compares references. equals() compares content.
Q26. String vs StringBuilder vs StringBuffer
Class | Mutable | Thread safe | Speed |
|---|---|---|---|
String | No | Yes (immutable) | Slower for repeated changes |
StringBuilder | Yes | No | Fast |
StringBuffer | Yes | Yes (synchronized) | Slower than StringBuilder |
Q27. How many objects does new String("abc") create?
Answer: Up to two: one in the String pool (if “abc” isn’t already there) and one in the heap for the new object.
Q28. What does intern() do?
Answer: It returns the pooled reference for a string, adding it to the pool if needed.
Q29. How do you reverse a string?
java
Q30. How do you check if a string is a palindrome?
java
MODULE 4: COLLECTIONS FRAMEWORK (Q31 TO Q42)
Q31. What is the Java Collections Framework?
Answer: A set of interfaces and classes for storing and processing groups of objects: List, Set, Queue and Map with implementations such as ArrayList, HashSet and HashMap.
Q32. ArrayList vs LinkedList
Point | ArrayList | LinkedList |
|---|---|---|
Structure | Dynamic array | Doubly linked list |
Random access | Fast | Slow |
Insert or delete in the middle | Slower (shifting) | Faster once positioned |
Memory | Less overhead | More overhead per element |
Q33. ArrayList vs Array?
Answer: Arrays have a fixed size and can hold primitives. ArrayList grows dynamically and holds objects.
Q34. HashSet vs TreeSet vs LinkedHashSet
Set | Order | Null allowed |
|---|---|---|
HashSet | No guaranteed order | One null |
LinkedHashSet | Insertion order | One null |
TreeSet | Sorted order | Not with natural ordering |
Q35. How does HashMap work internally?
Answer: Keys are hashed with hashCode() to find a bucket index. Entries in a bucket are compared using equals(). Collisions are stored in a linked list, which converts to a balanced tree when a bucket grows large (Java 8+). When the load factor (default 0.75) is exceeded, the table resizes.
Q36. Why must you override hashCode() when you override equals()?
Answer: Equal objects must produce equal hash codes. Otherwise hash-based collections like HashMap and HashSet may fail to find objects.
Q37. HashMap vs Hashtable vs ConcurrentHashMap
Class | Thread safe | Null keys |
|---|---|---|
HashMap | No | One null key allowed |
Hashtable | Yes (legacy, fully synchronized) | Not allowed |
ConcurrentHashMap | Yes (better concurrency) | Not allowed |
Q38. Comparable vs Comparator
Answer: Comparable defines a class’s natural order inside the class (compareTo). Comparator defines custom ordering outside the class (compare).
java
Q39. What is fail-fast behaviour?
Answer: Iterators of ArrayList and HashMap throw ConcurrentModificationException if the collection is modified during iteration, except through the iterator’s own remove().
Q40. Iterator vs for-each?
Answer: For-each is simpler. Iterator allows safe removal during iteration.
Q41. How do you remove duplicates from a list?
java
Q42. How do you count word frequency?
java
MODULE 5: EXCEPTION HANDLING (Q43 TO Q48)
Q43. Checked vs unchecked exceptions
Type | Checked at | Examples |
|---|---|---|
Checked | Compile time (must handle or declare) |
|
Unchecked | Runtime |
|
Q44. How do try, catch, finally work?
java
Q45. throw vs throws?
Answer: throw actually throws an exception object. throws declares in a method signature that it may throw an exception.
Q46. Does finally always run?
Answer: Almost always. It may not run if the JVM exits (for example System.exit()) or crashes.
Q47. What is try-with-resources?
java
Resources implementing AutoCloseable are closed automatically.
Q48. How do you create a custom exception?
java
MODULE 6: MULTITHREADING BASICS (Q49 TO Q54)
Q49. What is a thread? How do you create one?
Answer: A thread is a lightweight unit of execution. Create one by extending Thread or, preferably, implementing Runnable.
java
Q50. start() vs run()?
Answer: start() creates a new thread and calls run() in it. Calling run() directly just executes it in the current thread.
Q51. What is thread life cycle?
Answer: New, Runnable, Running, Blocked or Waiting, and Terminated.
Q52. What is synchronized?
Answer: A keyword that lets only one thread at a time execute a block or method on the same lock, preventing race conditions.
Q53. What is a deadlock?
Answer: Two or more threads wait for each other’s locks forever. Avoid it by acquiring locks in a consistent order and keeping locked sections short.
Q54. What is ExecutorService?
Answer: A framework for managing a pool of threads instead of creating threads manually.
java
MODULE 7: JAVA 8 ESSENTIALS (Q55 TO Q60)
Q55. What are the main Java 8 features?
Answer: Lambda expressions, functional interfaces, the Stream API, Optional, default and static methods in interfaces, method references and the new Date and Time API.
Q56. What is a lambda expression?
java
Q57. What is a functional interface?
Answer: An interface with exactly one abstract method, such as Runnable, Comparator or Function. It can be annotated @FunctionalInterface.
Q58. Stream example: filter, map, collect
java
Q59. What is Optional?
Answer: A container that may or may not hold a value, which helps avoid NullPointerException.
java
Q60. map() vs flatMap()?
Answer: map transforms each element one-to-one. flatMap transforms each element into a stream and flattens the results into one stream.
OUTPUT PUZZLES
Puzzle 1
java
Output: false, then true.
Puzzle 2
java
Output: 22. (a++ gives 10 and a becomes 11, then ++a makes it 12, so 10 + 12.)
Puzzle 3
java
Output: try, then finally. The finally block runs even with return.
Puzzle 4
java
Output: 30Java1020.
Puzzle 5
java
Output: true, then false. Small Integer values are cached, so == can behave unexpectedly. Use equals() for wrapper objects.
CODING ROUND: FIVE TASKS TO PRACTISE
Task | Skill tested |
|---|---|
Reverse a string and check a palindrome | Strings, loops |
Find the second largest number in an array | Arrays, logic |
Count word frequency in a sentence | HashMap |
Print the Fibonacci series | Loops, recursion |
Check if two strings are anagrams | Sorting, arrays or maps |
Sample: Fibonacci
java
TRAP QUESTIONS INTERVIEWERS ASK
Trap | Correct thinking |
|---|---|
“Is Java pass by reference?” | Java is always pass by value. For objects, the value is a copy of the reference. |
“Can we have a constructor in an interface?” | No. |
“Can | Yes, but the JVM calls only the standard |
“Is | No, it’s a class. |
“Can an abstract class have a constructor?” | Yes, called when a subclass is created. |
“Will | Yes, normally. |
“Does | A final reference can’t be reassigned, but the object it points to may still change. |
COMMON MISTAKES FRESHERS MAKE IN CORE JAVA INTERVIEWS
Mistake | Why it hurts | Better approach |
|---|---|---|
Memorising definitions without code | Follow-ups expose gaps | Pair each answer with a tiny example |
Confusing | Very common error | Remember references vs content |
Not knowing HashMap internals | It is a favourite question | Practise the bucket diagram |
Ignoring Java 8 | Looks outdated | Learn lambdas, streams, Optional |
Rushing into coding | Logic errors | Explain your approach first |
Bluffing | Easily caught | Say what you know, and how you’d find out |
Not running your own code | Listing code you can’t explain | Type and run every example |
14-DAY CORE JAVA PREPARATION PLAN
Day | Focus | Task |
|---|---|---|
1 | Basics | JDK/JRE/JVM, data types, static, final. Answer Q1 to Q10 aloud. |
2 | OOP part 1 | Classes, constructors, encapsulation, inheritance |
3 | OOP part 2 | Overloading vs overriding, abstract vs interface. Write examples. |
4 | Strings | Immutability, pool, |
5 | Collections 1 | List and Set implementations, comparison tables |
6 | Collections 2 | HashMap internals, equals/hashCode, Comparable vs Comparator |
7 | Revision and output puzzles | Solve the five puzzles without running them |
8 | Exceptions | Checked vs unchecked, finally, try-with-resources, custom exception |
9 | Multithreading | Runnable, start vs run, synchronized, deadlock |
10 | Java 8 | Lambda, streams, Optional |
11 | Coding practice 1 | Strings and arrays tasks |
12 | Coding practice 2 | HashMap, recursion and anagram tasks |
13 | Mock interview | Answer Q1 to Q60 aloud and note weak topics |
14 | Final polish | Explain your best project and its Java concepts |
MYTH VS REALITY
Myth | Reality |
|---|---|
“Core Java is old and not needed.” | Spring Boot and most Java jobs are built on core Java. |
“Memorising 100 questions is enough.” | Interviewers ask follow-ups, so understanding matters. |
“Only coding rounds matter.” | Concept rounds decide whether you reach the coding round. |
“Java 8 features are optional.” | Lambdas and streams are commonly expected. |
“HashMap is too advanced for freshers.” | It is one of the most common fresher questions. |
“One big project is enough.” | Interviewers also test fundamentals beyond the project. |
HOW VIBRANTMINDS HELPS FRESHERS CRACK JAVA INTERVIEWS
VibrantMinds Technologies Pvt. Ltd. is a Pune-based IT training and placement support company. If you searched for VibrantMinds or VibrantMinds Technologies, here is what it offers:
Full Stack Java Development (about 4 to 6 months): Core Java, OOP, collections, JDBC, SQL, Spring Boot, REST APIs, front-end basics, projects, aptitude and interview preparation. Please check the candidate portal for the latest syllabus and tools.
Core Java course (about 1 to 2 months) for strong fundamentals
Software Testing (Manual + Automation) and Python & Data Science for other career paths
Interview preparation: Technical rounds, coding practice, project rounds, HR rounds, aptitude, communication and mock interviews
Placement support: Screening, drive coordination and interview support. Check https://candidates.vibrantminds.in/ for current openings.
Free WhatsApp job alert groups for fresher IT jobs and drives
Honesty first: VibrantMinds offers placement support, not a guaranteed job, and no legitimate recruiter should ask you to pay to be interviewed.
VibrantMinds works as a talent ecosystem connecting candidates, colleges and companies, with 1900+ partner colleges and 600+ hiring companies. More fresher job guidance: https://candidates.vibrantminds.in/blog/fresher-jobs-pune-2026
VIBRANTMINDS COURSES AT A GLANCE
Course | Duration | Key topics |
|---|---|---|
Full Stack Java Development | 4 to 6 months | Core Java, OOP, JDBC, SQL, Spring Boot, REST APIs, front-end basics, projects, aptitude and interview preparation |
Software Testing (Manual + Automation) | 2 to 5 months | Test cases, STLC, bug tracking, SQL, Selenium basics |
Core Java | 1 to 2 months | Syntax, OOP, collections, exceptions, strings |
Python & Data Science | 2 to 4 months | Python basics, data handling, analysis fundamentals |
Fees, syllabus and batch dates are on https://candidates.vibrantminds.in/. Please confirm them directly before enrolling.
THE VIBRANTMINDS PLACEMENT PIPELINE: SIX STEPS
REAL OUTCOMES: WHAT TO EXPECT AND WHAT NOT TO
Past students have shared positive feedback about the training and support, and have gone on to roles at companies such as Aress Software and Education Technologies, Saama Technologies and Three M Software. Results vary by candidate, skill level, effort and market conditions, so please confirm details directly with the VibrantMinds team. No one can honestly promise a guaranteed job.
JOIN FREE VIBRANTMINDS WHATSAPP GROUPS: JAVA AND IT JOB UPDATES FOR FRESHERS IN PUNE AND INDIA
Looking for free WhatsApp groups, free IT job WhatsApp groups, a Java WhatsApp group for freshers or a job updates WhatsApp group in India? The VibrantMinds groups share fresher IT openings, campus drives, walk-in interview alerts and interview preparation updates, free of charge. Join whichever group has space. All three carry the same type of updates.
Group | What it offers | Link |
|---|---|---|
VibrantMinds Fresher IT Jobs, Group 1 | Fresher openings, campus drives, walk-in alerts | |
VibrantMinds Fresher IT Jobs, Group 2 | Fresher openings, campus drives, walk-in alerts | |
VibrantMinds Fresher IT Jobs, Group 3 | Fresher openings, campus drives, walk-in alerts |
Never pay to apply. Legitimate recruiters do not charge candidates for tests, interviews or offer letters. Do not share sensitive personal or financial details in any group chat.
FREQUENTLY ASKED QUESTIONS
1. What are the most asked core Java interview questions for freshers?
JDK vs JRE vs JVM, the four OOP pillars, overloading vs overriding, abstract class vs interface, String immutability and the String pool, == vs equals(), ArrayList vs LinkedList, how HashMap works, checked vs unchecked exceptions, start() vs run(), and Java 8 lambdas and streams.
2. How does HashMap work internally in Java for beginners?
HashMap uses a key’s hashCode() to choose a bucket, and equals() to find the exact key within that bucket. Collisions are stored together in the same bucket (as a linked list, converted to a tree when large in Java 8+). The table resizes when it passes the load factor, 0.75 by default.
3. Why is String immutable in Java?
Immutability makes the String pool safe, keeps Strings thread safe, allows hash codes to be cached and improves security. Any change creates a new String object, so use StringBuilder for repeated modifications.
4. How many days are enough to prepare core Java interview questions?
With basics already known, a focused 14-day plan like the one above is a reasonable start, studying a topic, writing code and answering aloud each day. The time needed varies by person, so adjust to your level.
5. Is there a free Java WhatsApp group for freshers in Pune?
Yes. VibrantMinds runs free fresher IT job WhatsApp groups that share Java and other IT openings, campus drives and walk-in alerts. Join through the links above, and always verify a job post and never pay to apply.
CONCLUSION: PREPARE FOR UNDERSTANDING, NOT JUST ANSWERS
The best way to handle core Java interview questions for freshers is to understand each concept well enough to explain it simply and show it in a few lines of code. Learn the four big topics (OOP, Strings, Collections, Exceptions), know HashMap, get comfortable with Java 8, practise the coding tasks and follow the 14-day plan. Stay honest about what you know.
If you’re in Pune and want structured Java training with practice projects, interview preparation and placement support, VibrantMinds Technologies is here to help.
Call to action:
Website: https://vibrantminds.in/
Candidate portal and courses: https://candidates.vibrantminds.in/
Fresher jobs guide: https://candidates.vibrantminds.in/blog/fresher-jobs-pune-2026
Join the free WhatsApp groups: the three links above
VISIT OR CONTACT VIBRANTMINDS IN PUNE
Company: VibrantMinds Technologies Pvt. Ltd.
Address: Viva Academy Building, Warje, Pune, Maharashtra 411052
Phone: +91 95035 79517
Email: support@vibrantmindstech.com
Website: https://vibrantminds.in/
Candidate portal and courses: https://candidates.vibrantminds.in/


