Answered step by step
Verified Expert Solution
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
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
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started