014-002-004

Inheritance: Superclass Constructor

Medium

Problem Description

inheritance: Superclass constructor

In this problem, you will create a program that implements a Dog class extending Animal, observes how the superclass constructor is automatically invoked, and displays two lines of output based on the animal name received from standard input.

Learning Objective

Learn that superclass constructor is automatically called during inheritance.

Problem

Create a Dog class that extends Animal class.

Input

Line 1: Animal name (string)

Output

Animal created: [name]
Dog barks: Woof!

Ready to Try Running Code?

Log in to access the code editor and execute your solutions for this problem.

Don't have an account?

Sign Up