A comprehensive collection of Java programs and projects designed for beginners and intermediate learners. This repository contains practical examples covering fundamental to intermediate concepts.
This repository is organized into two main sections:
Quick programs that demonstrate individual Java concepts:
| Program | What You'll Learn |
|---|---|
| BasicNotes.java | Java syntax basics and core concepts |
| CubeCalculator.java | Mathematical calculations and input handling |
| DecInt.java | Data type conversions (decimal to integer) |
| ElectricityBillCalc.java | Real-world calculations and conditionals |
| FileHandling.java | Reading and writing files in Java |
| MarksGrade.java | Using conditionals to assign grades |
| MultiTable.java | Loops and multiplication tables |
| NumberPattern.java | Loops and pattern printing |
| SimpleBankApplication.java | Object-oriented banking system |
| StarPatterns.java | Complex nested loops and pattern creation |
| StringOperations.java | String manipulation and built-in methods |
Handling collections of objects:
Employee.java- Employee class with propertiesCompany.java- Managing multiple employees- Learn about: Arrays, objects, data management
Understanding object-oriented hierarchy:
Animal.java- Parent class with common propertiesDog.java- Child class inheriting from AnimaloopInheritance.java- Practical inheritance examples- Learn about: Class hierarchy, method overriding, code reusability
Multiple forms of objects and methods:
engine.java- Base engine classcar.java- Car implementationoopPolymorphism.java- Polymorphism examples- Learn about: Method overriding, interface flexibility, dynamic binding
- Open the project in IntelliJ IDEA
- Right-click any
.javafile - Select "Run 'FileName.main()'"
- View output in the console
# Navigate to the project directory
cd LearnJava
# Compile a file
javac src/MarksGrade.java
# Run the compiled file
java -cp src MarksGrade- Install "Extension Pack for Java" by Microsoft
- Open the file you want to run
- Click the "Run" button (triangle icon) at the top right
- Output appears in the terminal
Start Here:
- BasicNotes.java - Understand the fundamentals
- CubeCalculator.java - Learn about variables and operations
- MultiTable.java - Master loops
- NumberPattern.java - Apply loops creatively
Then Move To: 5. StringOperations.java - Work with text 6. FileHandling.java - Read/write data 7. MarksGrade.java - Use conditionals effectively
Object-Oriented Programming: 8. SimpleBankApplication.java - Your first OOP project 9. Inheritance/ folder - Learn class relationships 10. EmployeeArrayHandler/ folder - Manage multiple objects 11. Polymorphism/ folder - Advanced OOP concepts
LearnJava/
├── src/
│ ├── BasicNotes.java
│ ├── CubeCalculator.java
│ ├── DecInt.java
│ ├── ElectricityBillCalc.java
│ ├── FileHandling.java
│ ├── MarksGrade.java
│ ├── MultiTable.java
│ ├── NumberPattern.java
│ ├── SimpleBankApplication.java
│ ├── StarPatterns.java
│ ├── StringOperations.java
│ ├── Tests.java
│ ├── EmployeeArrayHandler/
│ │ ├── Employee.java
│ │ └── Company.java
│ ├── Inheritance/
│ │ ├── Animal.java
│ │ ├── Dog.java
│ │ └── oopInheritance.java
│ └── Polymorphism/
│ ├── engine.java
│ ├── car.java
│ └── oopPolymorphism.java
├── LearnJava.iml (IntelliJ project file)
└── README.md (This file)
- ✅ Variables and data types
- ✅ Input/Output operations
- ✅ Operators and expressions
- ✅ Conditional statements (if/else)
- ✅ Loops (for, while, do-while)
- ✅ Pattern printing
- ✅ Break and continue statements
- ✅ String methods and manipulation
- ✅ File reading and writing
- ✅ Exception handling basics
- ✅ Classes and objects
- ✅ Inheritance (parent-child relationships)
- ✅ Polymorphism (method overriding)
- ✅ Arrays of objects
- ✅ Real-world application design
Before starting, make sure you have:
- Java Development Kit (JDK) 8 or higher installed
- IDE: IntelliJ IDEA, VS Code, or any Java-supported editor
- Basic understanding of programming concepts (variables, loops, conditionals)
java -version
javac -version- Read the Code First - Understand what each line does
- Run & Modify - Change values and see what happens
- Experiment - Try breaking and fixing the code
- Comment Your Code - Add notes to help future you understand
- Practice - Write similar programs from scratch
- Each program is independent - you can run them separately
- Some programs may ask for user input - read the console prompts carefully
- The Inheritance and Polymorphism folders contain multiple classes - run the main class file
- Always check the file paths when running file handling programs
Found a bug or want to improve a program? Feel free to:
- Fix it in your local copy
- Add comments to explain your changes
- Test before updating
This repository is for educational purposes. Feel free to use, modify, and learn from these programs.
Happy Learning! 🚀
Last Updated: May 2026