public class First {
public static void main(String[] args) {
// TODO Auto-generated method stub
Second obj = new Second();
Third obj1 = new Third();
obj.show();
obj1.show();
}
}
public class Second {
void show(){
System.out.println("Parent");
}
}
class Third extends Second{
void show(){
System.out.println("Child");
}
}
Output:-
Parent
Child
No comments:
Post a Comment