A complete, battle-tested, structured curriculum and repository for mastering modern Java. From core variables, control flow, and deep object-oriented programming to Java NIO, Stream API, Concurrency, and an Enterprise University Management System Capstone.
- 🎯 100% Code-First: Every single topic contains self-contained, compilable, and heavily commented Java source files.
- 💡 56+ Practical "WAP" Programs: Dedicated
programs/bank with classic interview & university examination problems. - 📝 Cheat Sheets Included: Each chapter contains a dedicated
notes.mdquick-reference guide. - 🏋️ Real-World Exercises: Each module ends with an interactive console project applying the learned concepts.
- 🚀 Modern Java (Java 8 to Java 21+): Covers Stream API, Lambdas, modern
switchexpressions, Pattern Matching forinstanceof, Java NIO.2, andAutoCloseable.
| Chapter | Module | Key Topics | Project / Exercise |
|---|---|---|---|
| 01 | Java Basics & Objects | main() Anatomy, JDK/JRE/JVM, Classes, Objects, Stack vs Heap |
Student ID Badge Generator |
| 02 | Data Types & Operators | 8 Primitives, Widening/Narrowing Casts, Operators, Strings, Scanner | Simple Calculator |
| 03 | Control Flow | if-else, Enhanced switch ->, Loops (for, while), 9 Star Patterns |
Number Guessing Game |
| 04 | Methods (Functions) | Pass-by-Value, Overloading, Recursion, Varargs (...) |
Math & Number Utility Toolkit |
| 05 | OOP: Classes Deep Dive | Constructors, this(), Encapsulation, static, final, Object Overrides |
Bank Account & Ledger System |
| 06 | OOP: Inheritance & Polymorphism | extends, super(), @Override, Abstract Classes, Interfaces |
Vector Graphics Canvas Engine |
| 07 | Arrays & Strings In-Depth | 2D Matrices, RegEx Parsing, StringBuilder, Comparable/Comparator |
Academic Ranker & Gradebook |
| 08 | Exception Handling | try-catch-finally, Checked vs Unchecked, Custom Exceptions, AutoCloseable |
Secure ATM & Auth Gateway |
| 09 | Collections Framework | ArrayList, LinkedList, HashMap, HashSet, Set Algebra, Iterators |
Smart CRM & Contact Directory |
| 10 | File I/O & Serialization | BufferedReader/Writer, Java NIO Files/Path, Object Serialization |
Persistent CRM Storage Engine |
| 11 | Functional Java (Java 8+) | Lambdas, java.util.function, Stream API, Optional, Method References |
Financial Stream Analytics Engine |
| 12 | Multithreading & Concurrency | Thread, Runnable, synchronized, AtomicInteger, ExecutorService |
Concurrent Web Asset Downloader |
| 13 | Capstone Project | Enterprise University Management System (UMS) integrating the entire stack | UniversityManagementApp.java |
Located in the programs/ directory:
📐 Section 1: Basic Math & Fundamentals (P01 – P08)
| # | Program File | Description |
|---|---|---|
| 01 | P01_SwapTwoNumbers.java | WAP to swap two numbers (temp variable, arithmetic, bitwise XOR) |
| 02 | P02_CelsiusToFahrenheit.java | WAP to convert temperature between Celsius and Fahrenheit |
| 03 | P03_SimpleAndCompoundInterest.java | WAP to calculate Simple and Compound Interest |
| 04 | P04_AreaPerimeterAllShapes.java | WAP to compute Area & Perimeter for Circle, Rectangle, Triangle, Sphere |
| 05 | P05_AsciiValueOfChar.java | WAP to print ASCII value of characters and toggle character cases |
| 06 | P06_QuotientAndRemainder.java | WAP to compute Quotient and Remainder with division verification |
| 07 | P07_LeapYearChecker.java | WAP to check if a year is a Leap Year (handling century leap years) |
| 08 | P08_OddOrEvenBitwise.java | WAP to check if a number is Odd or Even using bitwise AND (&) |
🔢 Section 2: Numbers & Logic (P09 – P18)
| # | Program File | Description |
|---|---|---|
| 09 | P09_ReverseNumber.java | WAP to reverse an integer number preserving sign |
| 10 | P10_PalindromeNumber.java | WAP to check if an integer is a Palindrome |
| 11 | P11_PrimeNumberChecker.java | WAP to check if number is Prime in |
| 12 | P12_ArmstrongNumber.java | WAP to check if an N-digit number is an Armstrong (Narcissistic) number |
| 13 | P13_FibonacciSeries.java | WAP to print Fibonacci sequence (Iterative & Recursive) |
| 14 | P14_FactorialLarge.java | WAP to calculate standard and arbitrary large factorials (BigInteger) |
| 15 | P15_GCDandLCM.java | WAP to find GCD (HCF) and LCM using Euclidean algorithm |
| 16 | P16_SumOfDigits.java | WAP to calculate sum and product of all digits of a number |
| 17 | P17_CountDigitsInNumber.java | WAP to count total digits in an integer via loops and |
| 18 | P18_StrongNumber.java | WAP to check if a number is a Strong / Krishnamurthy number |
✨ Section 3: Star & Number Patterns (P19 – P24)
| # | Program File | Description |
|---|---|---|
| 19 | P19_StarPyramidDiamond.java | WAP to print centered full Pyramid and Diamond patterns |
| 20 | P20_FloydsTriangle.java | WAP to print Floyd's Triangle of natural numbers |
| 21 | P21_PascalsTriangle.java | WAP to print Pascal's Triangle using binomial combinations |
| 22 | P22_HollowSquarePattern.java | WAP to print Hollow Square and Hollow Rectangle patterns |
| 23 | P23_BinaryNumberTriangle.java | WAP to print an alternating 0-1 Binary Triangle pattern |
| 24 | P24_NumberDiamondPattern.java | WAP to print a Palindromic Number Pyramid pattern |
📊 Section 4: 1D & 2D Arrays (P25 – P34)
| # | Program File | Description |
|---|---|---|
| 25 | P25_FindLargestAndSmallest.java | WAP to find maximum and minimum elements in an array in |
| 26 | P26_SecondLargestElement.java | WAP to find the Second Largest element in an array in a single pass |
| 27 | P27_ReverseArrayInPlace.java | WAP to reverse an array in-place without extra space (Two Pointers) |
| 28 | P28_RemoveDuplicatesSortedArray.java | WAP to remove duplicates from a sorted array in-place in |
| 29 | P29_LinearAndBinarySearch.java | WAP to implement Linear Search |
| 30 | P30_BubbleSortAndSelectionSort.java | WAP to implement Bubble Sort (optimized) and Selection Sort |
| 31 | P31_MergeTwoSortedArrays.java | WAP to merge two sorted arrays into a single sorted array in |
| 32 | P32_MatrixAdditionAndMultiplication.java | WAP to perform 2D Matrix Addition and Matrix Multiplication |
| 33 | P33_MatrixTransposeAndSymmetry.java | WAP to find Matrix Transpose and verify matrix symmetry |
| 34 | P34_RotateArrayByKPositions.java | WAP to rotate an array to the right by K positions (3-step reversal) |
🔤 Section 5: Strings & Character Processing (P35 – P42)
| # | Program File | Description |
|---|---|---|
| 35 | P35_ReverseStringWithoutBuiltIn.java | WAP to reverse a String without using reverse() built-in method |
| 36 | P36_PalindromeString.java | WAP to check if a String is a Palindrome ignoring punctuation/case |
| 37 | P37_CountVowelsConsonantsDigits.java | WAP to count vowels, consonants, digits, and special characters |
| 38 | P38_AnagramCheck.java | WAP to check if two Strings are Anagrams |
| 39 | P39_FirstNonRepeatedChar.java | WAP to find the first non-repeated character in a String |
| 40 | P40_RemoveDuplicateCharacters.java | WAP to remove all duplicate characters from a String |
| 41 | P41_CountWordsInSentence.java | WAP to count total words in a sentence without using split() |
| 42 | P42_ToggleCaseOfCharacters.java | WAP to toggle the case of every character in a String |
🏛️ Section 6: Object-Oriented Programming (P43 – P48)
| # | Program File | Description |
|---|---|---|
| 43 | P43_StudentClassEncapsulation.java | WAP to demonstrate Encapsulation with private fields and validation setters |
| 44 | P44_ConstructorOverloading.java | WAP to demonstrate Constructor Overloading and this() chaining |
| 45 | P45_SingleAndMultilevelInheritance.java | WAP to demonstrate Single and Multilevel Inheritance with super |
| 46 | P46_MethodOverridingPolymorphism.java | WAP to demonstrate Method Overriding and Dynamic Method Dispatch |
| 47 | P47_AbstractClassShapeHierarchy.java | WAP to demonstrate Abstract classes and abstract methods |
| 48 | P48_InterfaceMultipleInheritance.java | WAP to demonstrate multiple inheritance using Interfaces |
🛡️ Section 7: Exception Handling & File I/O (P49 – P52)
| # | Program File | Description |
|---|---|---|
| 49 | P49_CustomExceptionAgeValidation.java | WAP to create and throw a Custom Exception (InvalidAgeException) |
| 50 | P50_TryCatchFinallyDivideByZero.java | WAP to demonstrate try-catch-finally and multi-catch error handling |
| 51 | P51_ReadAndWriteTextFile.java | WAP to write text to a file and read it back line-by-line |
| 52 | P52_CountLinesWordsCharsInFile.java | WAP to count total lines, words, and characters in a text file |
🚀 Section 8: Collections, Streams & Concurrency (P53 – P56)
| # | Program File | Description |
|---|---|---|
| 53 | P53_ArrayListFrequencyCounter.java | WAP to find frequency of elements in an ArrayList using HashMap |
| 54 | P54_SortCustomObjectsComparable.java | WAP to sort custom objects by ID, Salary, and Name using Comparable/Comparator |
| 55 | P55_StreamFilterMapReduce.java | WAP to filter even numbers, square them, and sum using Stream API |
| 56 | P56_ProducerConsumerThreadQueue.java | WAP to implement multithreaded Producer-Consumer with wait() & notify() |
- Install JDK 17+ or JDK 21+ LTS (Download OpenJDK / Oracle JDK).
- Verify by running
javac -versionandjava -versionin your terminal.
# Clone the repository
git clone https://github.com/your-username/Learn-Java.git
cd Learn-Java
# Run Chapter Exercises
java chapter2.Exercise2
java chapter3.Exercise3
java chapter13.UniversityManagementApp# Compile the programs directory
javac programs/*.java
# Run any standalone program by name:
java programs.P01_SwapTwoNumbers
java programs.P11_PrimeNumberChecker
java programs.P30_BubbleSortAndSelectionSort
java programs.P55_StreamFilterMapReduceAfter completing this course, you are ready to transition to:
- Spring Boot 3.x: Dependency Injection, RESTful APIs, Spring Data JPA, Spring Security.
- Databases & ORM: PostgreSQL, MySQL, Hibernate, Liquibase/Flyway migrations.
- Automated Testing: JUnit 5, AssertJ, Mockito, Testcontainers.
- Cloud & DevOps: Dockerizing Java applications, CI/CD pipelines, Kubernetes deployment.
This repository is open-sourced under the MIT License. Feel free to fork, learn, and star ⭐ the repo!