We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
I think the code command below is suitable. mod apk
classSports{StringgetName(){return"Generic Sports";}voidgetNumberOfTeamMembers(){System.out.println("Each team has n players in "+getName());}}classSoccerextendsSports{@OverrideStringgetName(){return"Soccer Class";}@OverridevoidgetNumberOfTeamMembers(){System.out.println("Each team has 11 players in "+getName());}}publicclassMain{publicstaticvoidmain(String[]args){Sportssports=newSports();Soccersoccer=newSoccer();System.out.println(sports.getName());sports.getNumberOfTeamMembers();System.out.println(soccer.getName());soccer.getNumberOfTeamMembers();}}
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Java Method Overriding
You are viewing a single comment's thread. Return to all comments →
I think the code command below is suitable. mod apk