Challenge: InheritanceChallenge: Inheritance


Let's start with your first task. The assignment is posted on GitHub, and your task is to fork the repository and clone it to your IntelliJ. You can find instructions on how to do this in this chapter .

Link to the task: GitHub

There are several classes in the animals package. The Dog class has its own fields and methods, and there are three classes for different dog breeds: Bulldog, Doberman, and Beagle. The breed classes currently don't have their own fields and methods, but I need them to have the fields and methods from the Dog class. Inherit the Dog class in each of the breed classes and run the test to check if you have completed the task correctly.

Please do not modify the Dog class!
  • Open the src folder, then open the main/java/codefinity/animals folder;
  • You will see the Dog class and other subclasses;
  • Open the subclasses and add the extends Dog keyword;
  • Run tests by pressing the "Run Code" button.
    //Bulldog class
    public class Bulldog extends Dog {
    //Beagle class
    public class Beagle extends Dog {
    //Dobermann class
    public class Dobermann extends Dog {

    Everything was clear?

    Section 2. Chapter 3