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