Tuesday, February 24, 2009

example Recursive Constructor invocation



//sample code Recursive Constructor invocation
class Sample3
{
Sample3() // This is a compile time problem
{
this(10);
}
Sample(int i)
{
this(); // Invalid, error: recursive constructor invocation
}
public static void main(String a[])
{
System.out.println(“hai”);
}
}


0 comments:

Post a Comment