class Parent {
String s="Parent" ;
public Parent(){
method(); }
public void method()
{
System.out.println(s);
}
}
class Child extends Parent {
String s = "Child";
public Child(){
}
public void method(){
System.out.println(s);
}
}
public class Doubt {
public static void main(String[] args)
{
Child child = new Child();
}
}
SOURCE : www.referjava.com
No comments:
Post a Comment