6.14 Inheritance: Packages: Interfaces
Compile it as Person3.java
Line No. 3 & 4: declare two public methods called Learn() and Work()
Student3 Class
and StudentDemo To Show Overriding of Super Methods
1. package com.oops.chap6;
2. import com.oops.chap6.Person3;
3. class Student3 extends Person3 {
4. //public method
5. public void Learn()
6. {System.out.println(“Students Learn at college”);}
7. public void Work()
8. {System.out.println(“Students work at college labs”);}
9. public void Play()
10. {System.out.println(“Students play at college grounds”);}
11. }//end of class Student3
12. // Driver class
13. class StudentDemo3{
14. public static void main(String[] args){
15. // create an object of Student
16. Student3 std = new Student3(); ...