6.10 Inheritance: Packages: Interfaces
36. }//end of class Student
37. }
38. // Driver class
39. class Student2bDemo{
40. public static void main(String[] args){
41. // create an object of Student
42. Student2b std1 = new Student2b(“Ramesh”,50595,97.8,”X”);
43. std1.ComputeGrade(std1);
44. std1.DisplayData(std1);
45. System.out.println(“Total Marks:” + std1.GetMarks());
46. System.out.println(„Grade:“ + std1.GetGrade());
47. }
48. }//end of class Student2bDemo
Line No.2: shows that Student2b extends to Person2b. This means that it has
access to all public and protected members like protected String
name, protected int idNo and method DisplayData() of Person2b.
Line Nos. 4 and 5: declare Student2b private data and Line Nos. 20–23 define mutator