017-005-007
Basic Multiple Interface Implementation
Easy
Problem Description
Basic Multiple Interface Implementation
In this problem, you will create a program that implements both Swimmable and Flyable interfaces in a Duck class, then calls each interface method and displays the results to standard output.
Learning Objective: Understand how to implement multiple interfaces in a single class
Overview
Create a Duck class that implements both Swimmable and Flyable interfaces.
Specifications
Swimmableinterface: hasvoid swim()methodFlyableinterface: hasvoid fly()methodDuckclass: implements both interfacesswim()outputs "Duck is swimming"fly()outputs "Duck is flying"- In
mainmethod, create a Duck instance and call both methods
Output Format
Duck is swimming
Duck is flying
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