• + 0 comments

    why this code is not working? import java.util.*; class Sports{

    String getName(){
        return "Generic Sports";
    }
    
    void getNumberOfTeamMembers(){
        System.out.println( "Each team has n players in " + getName() );
    }
    

    }

    class Soccer extends Sports{ @Override String getName(){ return "Soccer Class"; } class Sports{ String getName(){ return "Generic Sports"; } void getNumberOfTeamMembers(){ System.out.println("Each has n players in"+getName()); } } class Succer extends Sports{ String getName(){ return "Succer Class"; } void getNumberOfTeamMembers(){ System.out.println("Each has 11 players in"+getName()); } } // Write your overridden getNumberOfTeamMembers method here

    }

    public class Solution{

    public static void main(String []args){
        Sports c1 = new Sports();
        Soccer c2 = new Soccer();
        System.out.println(c1.getName());
        c1.getNumberOfTeamMembers();
        System.out.println(c2.getName());
        c2.getNumberOfTeamMembers();
    }
    

    }