Skip to content

Naxisbeast/object-oriented-programming-java

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 

Repository files navigation

Object-Oriented Programming In Java

Overview

This repository is a student learning portfolio for Object-Oriented Programming (OOP) in Java. It contains clean, readable examples that demonstrate core OOP concepts without turning the project into an over-engineered framework.

I am building this as part of my GitHub student portfolio for bursaries, internships, graduate programmes, and future Honours opportunities.

Why I Created This Repository

OOP is important for writing organised, reusable, and maintainable code. This repository helps me practise Java fundamentals in a way that I can explain clearly.

Current Scope

This foundation repo covers:

  • Classes and objects
  • Encapsulation
  • Inheritance
  • Polymorphism
  • Abstraction
  • Interfaces

Concepts Covered

Concept Example Folder What It Shows
Classes and objects src/classes_objects Creating objects, constructors, getters, setters, and toString
Encapsulation src/encapsulation Protecting fields and using methods to control changes
Inheritance src/inheritance Reusing and extending superclass behaviour
Polymorphism src/polymorphism Overriding, overloading, and superclass references
Abstraction src/abstraction Abstract classes and required subclass behaviour
Interfaces src/interfaces Classes implementing a shared contract

Repository Structure

object-oriented-programming-java/
|-- README.md
|-- notes/
|   `-- oop-principles.md
`-- src/
    |-- abstraction/
    |   |-- Car.java
    |   |-- Motorcycle.java
    |   |-- Vehicle.java
    |   `-- VehicleTest.java
    |-- classes_objects/
    |   |-- Student.java
    |   `-- StudentTest.java
    |-- encapsulation/
    |   |-- BankAccount.java
    |   `-- BankAccountTest.java
    |-- inheritance/
    |   |-- InheritanceTest.java
    |   |-- Lecturer.java
    |   |-- Person.java
    |   `-- StudentPerson.java
    |-- interfaces/
    |   |-- AcademicReport.java
    |   |-- InterfaceTest.java
    |   `-- Reportable.java
    `-- polymorphism/
        |-- CardPayment.java
        |-- CashPayment.java
        |-- Payment.java
        `-- PaymentTest.java

How To Compile And Run

From the repository root, compile all current examples into an out folder:

mkdir out
javac -d out src/classes_objects/*.java src/encapsulation/*.java src/inheritance/*.java src/polymorphism/*.java src/abstraction/*.java src/interfaces/*.java

Run a specific test class:

java -cp out classes_objects.StudentTest
java -cp out encapsulation.BankAccountTest
java -cp out inheritance.InheritanceTest
java -cp out polymorphism.PaymentTest
java -cp out abstraction.VehicleTest
java -cp out interfaces.InterfaceTest

If you are using VS Code or IntelliJ, open the repository folder and run any test class with a main method.

What I Learned

  • How classes model real-world objects.
  • How constructors create objects with starting values.
  • How encapsulation protects fields from unsafe changes.
  • How inheritance lets related classes share common behaviour.
  • How polymorphism lets the same method call behave differently.
  • How abstract classes and interfaces define expected behaviour.

Planned Extensions

This repository currently focuses on OOP foundations. Future improvements may include:

  • Student Management System mini-project
  • Bank Account Simulation mini-project
  • Exception handling
  • File handling with objects
  • UML class diagrams
  • Basic unit tests

About

Java Object-Oriented Programming Practice

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages