Skip to content

LamaBimal/java-oop-fundamentals

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

6 Commits
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Java OOP Fundamentals

Welcome to the Java OOP Fundamentals! πŸŽ‰ This repository is designed for beginners who want to learn the fundamentals of Object-Oriented Programming (OOP) in Java.

πŸ“ What You'll Learn

  • Encapsulation: How to protect data and expose behavior.
  • Inheritance: Building relationships between classes.
  • Polymorphism: Achieving flexibility with interfaces and overridden methods.
  • Abstraction: Defining contracts and shared behavior using abstract classes.

πŸ“‚ Project Structure

src/com/starterkit/
β”œβ”€β”€ abstraction/
β”‚   β”œβ”€β”€ Employee.java
β”‚   β”œβ”€β”€ SalariedEmployee.java
β”‚   └── AbstractionDemo.java
β”œβ”€β”€ encapsulation/
β”‚   β”œβ”€β”€ BankAccount.java
β”‚   └── EncapsulationDemo.java
β”œβ”€β”€ inheritance/
β”‚   β”œβ”€β”€ Animal.java
β”‚   β”œβ”€β”€ Dog.java
β”‚   └── InheritanceDemo.java
└── polymorphism/
    β”œβ”€β”€ Shape.java
    β”œβ”€β”€ Circle.java
    β”œβ”€β”€ Rectangle.java
    └── PolymorphismDemo.java

πŸš€ How to Use

  1. Clone this repository:

    git clone https://github.com/LamaBimal/Java-OOP-StarterKit.git
    cd Java-OOP-StarterKit
  2. Compile all Java files:

    mkdir -p out
    javac -d out $(find src -name "*.java")
  3. Run any demo class:

    java -cp out com.starterkit.encapsulation.EncapsulationDemo
    java -cp out com.starterkit.inheritance.InheritanceDemo
    java -cp out com.starterkit.polymorphism.PolymorphismDemo
    java -cp out com.starterkit.abstraction.AbstractionDemo

🎯 Suggested Learning Path

  1. Start with encapsulation/BankAccount.java to understand private state and controlled mutation.
  2. Move to inheritance/Animal.java and inheritance/Dog.java for parent-child relationships.
  3. Continue with polymorphism/Shape.java and implementations to see one interface, multiple behaviors.
  4. Finish with abstraction/Employee.java to learn abstract class contracts.

🀝 Contributing

Feel free to fork this repo, add your own OOP examples, and open a pull request.

About

A hands-on Java OOP learning repository demonstrating core object-oriented programming concepts through simple and practical examples.

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages