|
1 |
| -Code snippets and mini-projects to understand and practice OOP principles in Java. |
| 1 | +# 📘 OOP Concepts in Java – Example Codes |
| 2 | + |
| 3 | +A collection of **beginner-to-advanced examples** that demonstrate the core principles of **Object-Oriented Programming (OOP)** using Java. |
| 4 | +This repository is designed to help students, beginners, and interview candidates **understand, practice, and master OOP** with small, practical code snippets. |
| 5 | + |
| 6 | +--- |
| 7 | + |
| 8 | +## 🎯 What You’ll Learn |
| 9 | +- ✅ Classes & Objects |
| 10 | +- ✅ Encapsulation |
| 11 | +- ✅ Inheritance |
| 12 | +- ✅ Polymorphism (Overloading & Overriding) |
| 13 | +- ✅ Abstraction (Abstract classes & Interfaces) |
| 14 | +- ✅ Composition, Aggregation & Association |
| 15 | +- ✅ Static & Final usage |
| 16 | +- ✅ Constructor Overloading |
| 17 | +- ✅ Inner Classes |
| 18 | +- ✅ Enums |
| 19 | +- ✅ Interfaces & Multiple Inheritance |
| 20 | +- ✅ Design Patterns (Singleton, Factory, Strategy, Observer) |
| 21 | + |
| 22 | +--- |
| 23 | +## 📂 Project Structure |
| 24 | + |
| 25 | + |
| 26 | +```text |
| 27 | +oop-concepts-examples/ |
| 28 | +│ |
| 29 | +├── encapsulation/ # Getters/Setters, Private fields, Immutable classes |
| 30 | +├── inheritance/ # Parent/Child classes, Super/Override |
| 31 | +├── polymorphism/ # Overloading, Overriding, Interfaces |
| 32 | +├── abstraction/ # Abstract classes & methods, Interfaces |
| 33 | +├── composition/ # HAS-A relationships (Car → Engine) |
| 34 | +├── association/ # Teacher–Student, Department–Professors |
| 35 | +├── static-final/ # Static methods, Constants |
| 36 | +├── constructors/ # Constructor overloading examples |
| 37 | +├── inner-classes/ # Static & Non-static inner classes |
| 38 | +├── enums/ # Day, OrderStatus enums |
| 39 | +├── interfaces/ # Multiple inheritance with interfaces |
| 40 | +└── design-patterns/ # Singleton, Factory, Strategy, Observer |
| 41 | +
|
| 42 | +
|
| 43 | +``` |
| 44 | + |
| 45 | +## 🚀 Getting Started |
| 46 | +### 1. Clone the repository |
| 47 | +```bash |
| 48 | +git clone https://github.com/nuwanthikaishani/oop-fundamentals-java |
| 49 | +cd oop-fundamentals-java |
| 50 | +``` |
| 51 | + |
| 52 | +### 2. Compile and Run |
| 53 | +```bash |
| 54 | +cd src/encapsulation |
| 55 | +javac EncapsulationDemo.java |
| 56 | +java EncapsulationDemo |
| 57 | +``` |
| 58 | + |
| 59 | +## 🎓 Who Is This For? |
| 60 | +- ✅ Students learning Java OOP for the first time |
| 61 | +- ✅ Developers preparing for coding interviews |
| 62 | +- ✅ Anyone who wants a quick refresher on OOP principles |
| 63 | + |
| 64 | + |
| 65 | + |
| 66 | + |
0 commit comments