Hi,
I was preparing for SCJP 1.6 and i have the following snippet of code.
package com.self.trials3;
public class Animal {
public void Animal(){
System.out.println("Obviously Works");
}
Animal(){
//System.out.println("Constructor");
//super();use super or this() as first line in your cons to call other //cons.
this("Adarsh");
}
Animal(String AnimalName){
//System.out.println("AnimalName >> "+ AnimalName);
this(); //cannot use , recursive cursor invocation infinite loop
}
}
When the above code is used in my eclipse , i get the error that is recursive cursor invocation infinite loop. But the SCJP book says that this should work fine , but in turn gives a stack overflow error during runtime which is obvious should it compile.
My question is whether this has been a new feature added to java 6 or am i missing something ?