Skip to content

Beginner-friendly Java OOP programs covering encapsulation, constructors, inheritance, and basic class design. Includes four foundational tasks (1.1–1.4) demonstrating core object-oriented principles with examples and screenshots.

License

Notifications You must be signed in to change notification settings

TheComputationalCore/java-oop-fundamentals

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

46 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Java OOP Fundamentals

Java Build License: MIT

This repository contains Java programs demonstrating fundamental Object-Oriented Programming (OOP) concepts such as encapsulation, inheritance, and basic class design. It includes four tasks (1.1 to 1.4), each illustrating a different OOP principle.

📁 Project Structure

java-oop-fundamentals/
│
├── .github/
│   └── workflows/
│       └── java-build.yml
│
├── screenshots/
│   ├── 1.1.png
│   ├── 1.2.a.png
│   ├── 1.2.b.png
│   ├── 1.3.png
│   └── 1.4.png
│
├── src/
│   ├── Account.java
│   ├── Person.java
│   ├── Person_2.java
│   ├── Product.java
│   └── XYZ.java
│
├── LICENSE
└── README.md

📝 Task Overviews

Task 1.1 — Person Class

  • Implements a Person class with name and age.
  • Default age is 18.
  • Includes constructor + method to display info.

▶️ Screenshot:
1.1


Task 1.2 — Product Class

  • Represents products with pid, price, and quantity.
  • ProductMain:
    • Accepts 5 products.
    • Finds highest price product.
    • Calculates total expenditure.

▶️ Screenshots:
1.2a 1.2b


Task 1.3 — Account Class

  • Implements deposit, withdraw, and display methods.
  • Includes default + parameterized constructors.

▶️ Screenshot:
1.3


Task 1.4 — Inheritance (Person → Employee)

  • Employee extends Person.
  • Adds employeeID and salary.
  • Uses super() for parent initialization.

▶️ Screenshot:
1.4


▶️ Running the Programs

1. Clone the Repository

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

2. Compile

javac *.java

3. Run (examples)

java Person
java Product
java Account
java XYZ

📦 Requirements

  • Java JDK 8 or higher
  • Any terminal or Java IDE

📄 License

This project is licensed under the MIT License.

About

Beginner-friendly Java OOP programs covering encapsulation, constructors, inheritance, and basic class design. Includes four foundational tasks (1.1–1.4) demonstrating core object-oriented principles with examples and screenshots.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages