Skip to content

Topic 1: Review OOP

Zhamri Che Ani edited this page Apr 10, 2026 · 3 revisions

Goal

To reinforce students’ understanding of fundamental Object-Oriented Programming (OOP) concepts as a foundation for developing enterprise-level applications using Java.

🎯 Learning Objectives

Students should be able to:

  1. Explain core OOP concepts including objects, classes, and packages
  2. Apply inheritance and polymorphism in Java programs
  3. Differentiate between access modifiers (public, protected, private)
  4. Design abstract classes and implement interfaces

📌 Topics to Cover

  1. Object-Oriented Programming Concepts
    • Objects and Classes
    • Packages
  2. Inheritance
    • Extending classes
    • Reusing fields and methods
  3. Polymorphism
    • Method overriding
    • Dynamic binding
  4. Access Modifiers
    • public, protected, private
  5. Abstract Classes
    • Abstract methods
    • When to use abstraction
  6. Interfaces
    • Defining contracts
    • Implementing interfaces

🛠️ Hands-on Activity

Activity: Designing a Simple Class Hierarchy

Students are required to:

  1. Create a base class: Vehicle
    • Attributes: brand, speed
    • Method: displayInfo()
  2. Create subclasses using inheritance:
    • Car
    • Motorcycle
  3. Apply Polymorphism:
    • Override displayInfo() in each subclass
    • Each class should display different information
  4. Use Access Modifiers:
    • Apply private, protected, and public appropriately
  5. Create an Interface: Drivable
    • Method: drive()
    • Implement this interface in Car and Motorcycle
  6. Use Abstract Class (Optional Enhancement):
    • Convert Vehicle into an abstract class
    • Add abstract method startEngine()

Expected Output

Students should produce:

  1. A simple class diagram (Vehicle → Car, Motorcycle)
  2. Java classes demonstrating:
    • Inheritance
    • Polymorphism
    • Interface implementation
  3. Sample output (console):
Car is driving at 120 km/h
Motorcycle is driving at 80 km/h

📚 Suggested Readings

  1. Oracle Java Documentation – OOP Concepts https://docs.oracle.com/javase/tutorial/java/concepts/
  2. Online tutorial: https://www.w3schools.com/java/java_oop.asp

Clone this wiki locally