class Player
{
public String name;
public String Country;
public int JersyNo;
public int age;
public void setdata(String a,String b,int c,int d)
{
name=a;
Country=b;
JersyNo=c;
age=d;
}
public void getdata()
{
System.out.println("Name is"+name);
System.out.println("Country is is"+Country);
System.out.println("JersyNo is"+JersyNo);
System.out.println("Age is"+age);
}
}
class Cricket_Player extends Player
{
public void setdata(String a,String b,int c,int d)
{
name=a;
Country=b;
JersyNo=c;
age=d;
}
}
class Football_Player extends Player
{
public void setdata(String a,String b,int c,int d)
{
name=a;
Country=b;
JersyNo=c;
age=d;
}
}
class Hockey_Player extends Player
{
public void setdata(String a,String b,int c,int d)
{
name=a;
Country=b;
JersyNo=c;
age=d;
}
}
class PlayerMain
{
public static void main(String args[])
{
Player p=new Player();
Cricket_Player c=new Cricket_Player();
System.out.println("Detail of Cricket player is");
c.setdata("Rahul Dravid","India",19,40);
c.getdata();
System.out.println("Detail of Hockey player is");
Hockey_Player h=new Hockey_Player();
h.setdata("Sandeep singh","India",4,26);
h.getdata();
System.out.println("Detail of Football player is");
Football_Player f=new Football_Player();
f.setdata("Cristiano Ronaldo","PORTUGAL",23,30);
f.getdata();
}
}
{
public String name;
public String Country;
public int JersyNo;
public int age;
public void setdata(String a,String b,int c,int d)
{
name=a;
Country=b;
JersyNo=c;
age=d;
}
public void getdata()
{
System.out.println("Name is"+name);
System.out.println("Country is is"+Country);
System.out.println("JersyNo is"+JersyNo);
System.out.println("Age is"+age);
}
}
class Cricket_Player extends Player
{
public void setdata(String a,String b,int c,int d)
{
name=a;
Country=b;
JersyNo=c;
age=d;
}
}
class Football_Player extends Player
{
public void setdata(String a,String b,int c,int d)
{
name=a;
Country=b;
JersyNo=c;
age=d;
}
}
class Hockey_Player extends Player
{
public void setdata(String a,String b,int c,int d)
{
name=a;
Country=b;
JersyNo=c;
age=d;
}
}
class PlayerMain
{
public static void main(String args[])
{
Player p=new Player();
Cricket_Player c=new Cricket_Player();
System.out.println("Detail of Cricket player is");
c.setdata("Rahul Dravid","India",19,40);
c.getdata();
System.out.println("Detail of Hockey player is");
Hockey_Player h=new Hockey_Player();
h.setdata("Sandeep singh","India",4,26);
h.getdata();
System.out.println("Detail of Football player is");
Football_Player f=new Football_Player();
f.setdata("Cristiano Ronaldo","PORTUGAL",23,30);
f.getdata();
}
}
No comments:
Post a Comment