017-004-007

Introduction to Interface Extension

Easy

Problem Description

Introduction to Interface Extension

In this problem, you will create a program that defines a FastMovable interface extending Movable, implements it in a Runner class, and displays the results of calling both move() and sprint() to standard output.

Learning Objective: Understand that interfaces can extend other interfaces

Overview

Declare move() in Movable interface. FastMovable extends Movable and adds sprint(). Runner class implements FastMovable.

Specifications

  1. Declare void move() in Movable
  2. FastMovable extends Movable and adds void sprint()
  3. Runner implements FastMovable: move() prints Walking..., sprint() prints Sprinting!
  4. In main, create Runner and call both methods

Output Format

Walking...
Sprinting!

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