This project serves as a structured learning resource for core Java concepts. Each package represents a different Java topic, and within each package, there is a class with a main method that can be uncommented and executed to see the concept in action.
The goal of this project is to build deep conceptual understanding of Java fundamentals through practical examples.
- Explore Packages – Each package covers a different core Java topic.
- Run Examples – Execute the
mainmethod inside each class. - Observe Output Carefully – Focus on why the output occurs.
- Read Comments – Each class explains the concept in detail.
- Experiment – Modify code and observe behavior changes.
- Comparable – Defines natural ordering of objects
- Comparator – Defines custom sorting logic
- Sorting objects using both approaches
- Understanding Thread vs Runnable
- Creating threads using:
- Extending
Thread - Implementing
Runnable
- Extending
- Inter-thread communication using:
wait()notify()
- Example:
- Printing Even & Odd Numbers using two threads in sequence
This module demonstrates core OOP concepts in Java:
- Method Overriding (Runtime Polymorphism)
- Method Overloading (Compile-time Polymorphism)
- Variable Hiding vs Method Overriding
- Static Method Hiding
- Upcasting & Downcasting
- Runtime Method Dispatch
- ClassCastException (Unsafe Casting)
- Fields are resolved at compile-time
- Methods are resolved at runtime (dynamic binding)
- Static methods are resolved based on reference type
- Overloading is decided at compile-time
- Overriding is decided at runtime
A obj = new B()→ demonstrates runtime polymorphismobj.xvsobj.show()→ variable vs method behavior- Safe vs unsafe casting
- Parent calling overridden methods
- String immutability in Java
- Difference between:
- Heap objects (
new String()) - String Constant Pool (SCP)
- Heap objects (
- Behavior of:
toUpperCase()toLowerCase()toString()
- Strings are immutable
- Operations create new objects only if content changes
- JVM optimizes memory by reusing objects when possible
- Reference comparison (
==) behavior - Same object reuse vs new object creation
This project is designed to:
- Build strong fundamentals
- Encourage experimentation over memorization
- Develop interview-level clarity
- Strengthen problem-solving mindset
- Exception Handling
- Collections Framework (Deep Dive)
- Generics
- Java Memory Model
- Advanced Multithreading (ExecutorService, Locks, etc.)
Feel free to:
- Add more examples
- Improve explanations
- Extend into advanced topics
Don’t just run the code — understand why it behaves that way.
That’s what makes you a strong developer.