NBKRIST Java Hub

← Back to Exam Panel

Problem Statement: Animal & Dog

Your task is to create two simple Java classes to represent an **Animal** and a **Dog**. This problem will help you understand **Inheritance** by showing how a Dog can inherit common traits from the Animal class.

Functional Requirements

Technical Requirements

Testing Requirements

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

  1. Dog Object Test:
    • Create a Dog object and set its species to "Canine" and its breed to "Labrador".
    • Call the fetch() method. The output should confirm the dog is fetching.
    • Call the makeSound() method. The output should confirm the animal is making a sound.
    • This test shows that the Dog object has access to both its own methods and the methods it inherited from the Animal class.