We need not to access the super class default Constructor, by default it is present in sub/child class. Example:
class Parent
{
Parent()
{
int
i=12;
System.out.println("i
is : "+i);
}
}
class Child extends Parent
{
Child()
{
int
i=8;
System.out.println("i
is : "+i);
}
}
class
DefaultConstructorIsCallAutomatically
{
public
static void main(String args[])
{
Child t=new Child();
}
}
O/P:
i
is : 12
i is : 8
No comments:
Post a Comment