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
- Declare
void move()inMovable FastMovableextendsMovableand addsvoid sprint()RunnerimplementsFastMovable:move()printsWalking...,sprint()printsSprinting!- 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