This repository is designed to help learners understand and practice Object-Oriented Programming (OOP) in Java through hands-on examples and exercises.
It is suitable for:
- Students taking introductory or intermediate Java courses
- Professionals refreshing their Java and OOP skills
- Anyone preparing for technical interviews
This repository is structured to combine theory, examples, and exercises:
Each topic includes explanations, code examples, and practice tasks:
- Classes and Objects
- Encapsulation
- Inheritance
- Polymorphism
- Abstraction
- Interfaces
- Composition vs Inheritance
Well-structured Java programs demonstrating:
- Best practices
- Common design patterns (introductory level)
- Clean and readable code
Each section contains exercises of varying difficulty:
- 🟢 Beginner — basic syntax and concepts
- 🟡 Intermediate — combining multiple concepts
- 🔴 Advanced — design-oriented problems
Some exercises include:
- Starter code
- Expected outputs
- Hints or partial solutions
- Clear and well-documented solutions
- Multiple approaches where relevant
- Explanation of key ideas
/topics
/introduction
/classes-objects
/information-hiding-and-encapsulation
/strings
/abstraction
/inheritance-and-polymorphism
/abstract-classes-and-interfaces
/graphical-user-interfaces-GUI
/event-driven-programming
/exceptions
/examples
/exercises
/solutions
- Basic programming knowledge
- Java JDK (version 8 or higher recommended)
- Any IDE (e.g., IntelliJ IDEA, Eclipse, VS Code)
- Clone the repository:
git clone https://github.com/mulangonando/Object-Oriented-Programming.git- Navigate to a topic or exercise:
cd exercises/inheritance- Compile and run:
javac Main.java
java Main- Start with the topics to understand concepts
- Review examples to see how they are applied
- Solve exercises without looking at solutions first
- Use solutions to verify and improve your approach
By working through this repository, you will:
- Build a strong foundation in Java OOP
- Learn to design clean and maintainable code
- Understand real-world object-oriented design
- Improve problem-solving skills
Contributions are welcome!
You can:
- Add new exercises
- Improve explanations
- Fix bugs or typos
- Suggest better solutions
Please open an issue or submit a pull request.
This project is open-source and available under the Apache License 2.0.
If you find this repository helpful:
- Star the repo
- Share it with others
- Use it in your learning or teaching