Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Consider this following code: public interface Sport t public String getSportsName public String geteacueName) public class MainClassf public static void main(String[l args) Arrayist listnew Arrayist

image text in transcribed

Consider this following code: public interface Sport t public String getSportsName public String geteacueName) public class MainClassf public static void main(String[l args) Arrayist listnew Arrayist( ist.add(getsport" Football")); ist.addlgetSport"Basketball")D for(Sport s: list) public static Sport getSport(String name) if oame.eguals(" Football")) return new Football(); return new Basketball return null else if(pame.equals("Basketball") else The output of this code is: Sport-Football, league NFL Sport-Basketball, league NBA Write your code for Football and Basketball class Football Class class Football implements Sport //write code here: Basketball class class Basketball implements Sportf //write code here

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions