Skip to content

nuwanthikaishani/oop-fundamentals-java

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

📘 OOP Concepts in Java – Example Codes

A collection of beginner-to-advanced examples that demonstrate the core principles of Object-Oriented Programming (OOP) using Java.
This repository is designed to help students, beginners, and interview candidates understand, practice, and master OOP with small, practical code snippets.


🎯 What You’ll Learn

  • ✅ Classes & Objects
  • ✅ Encapsulation
  • ✅ Inheritance
  • ✅ Polymorphism (Overloading & Overriding)
  • ✅ Abstraction (Abstract classes & Interfaces)
  • ✅ Composition, Aggregation & Association
  • ✅ Static & Final usage
  • ✅ Constructor Overloading
  • ✅ Inner Classes
  • ✅ Enums
  • ✅ Interfaces & Multiple Inheritance
  • ✅ Design Patterns (Singleton, Factory, Strategy, Observer)

📂 Project Structure

oop-concepts-examples/ │ ├── encapsulation/ # Getters/Setters, Private fields, Immutable classes ├── inheritance/ # Parent/Child classes, Super/Override ├── polymorphism/ # Overloading, Overriding, Interfaces ├── abstraction/ # Abstract classes & methods, Interfaces ├── composition/ # HAS-A relationships (Car → Engine) ├── association/ # Teacher–Student, Department–Professors ├── static-final/ # Static methods, Constants ├── constructors/ # Constructor overloading examples ├── inner-classes/ # Static & Non-static inner classes ├── enums/ # Day, OrderStatus enums ├── interfaces/ # Multiple inheritance with interfaces └── design-patterns/ # Singleton, Factory, Strategy, Observer 

🚀 Getting Started

1. Clone the repository

git clone https://github.com/nuwanthikaishani/oop-fundamentals-java cd oop-fundamentals-java

2. Compile and Run

cd src/encapsulation javac EncapsulationDemo.java java EncapsulationDemo

🎓 Who Is This For?

  • ✅ Students learning Java OOP for the first time
  • ✅ QA Engineers preparing for coding interviews
  • ✅ Anyone who wants a quick refresher on OOP principles

About

Code snippets and mini-projects to understand and practice OOP principles in Java.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages