NBKRIST Java Hub

← Back to Exam Panel

Problem Statement: Simple Vehicle & Car

Your task is to create two simple Java classes to represent a **Vehicle** and a **Car**. The goal is to understand a fundamental concept of object-oriented programming: **Inheritance**. You will learn how one class (Car) can get features from another class (Vehicle).

Functional Requirements

Technical Requirements

Testing Requirements

Your main method must demonstrate the program works by testing the following scenario:

  1. Car Object Test:
    • Create a Car object and assign it a brand (e.g., "Toyota") and number of doors (e.g., 4).
    • Call the `startEngine()` method. The output should confirm the engine started.
    • Call the `honk()` method. The output should confirm the vehicle is honking.
    • This test shows that the `Car` object has access to both its own methods and the methods it inherited from the `Vehicle` class.