6.12 Inheritance: Packages: Interfaces
21. public String GetLevel(){return level;}
22. //public method
23. public void DisplayData(Athlete2b ath2b) {
24. super.DisplayData(ath2b);
25. System.out.println(“Details from Athlete2b are :”);
26. System.out.println(“Sport:” + ath2b.GetSport());
27. System.out.println(“Level:” + ath2b.GetLevel());
28. }//end of class Student
29. }
30. // Driver class
31. class Athlete2bDemo{
32. public static void main(String[] args){
33. // create an object of Athlet
34. Athlete2b ath1 = new Athlete2b (“Ramesh”,50595,97.8,”X”,”Foo
tBall”,”S”);
35. ath1.ComputeGrade(ath1);
36. ath1.DisplayData(ath1);
37. }
38. }//end of class Athlete2bDemo
Output : Super(name,idNO) called
Person Details are…… Id Number:50595 Name:Ramesh
Details from Student2b ...