FileDocCategorySizeDatePackage
ConsRecurs.javaAPI DocExample399Sat Nov 25 12:54:10 GMT 2000None

ConsRecurs.java

/** What happens when two constructors call each other?
 * Can you get an infinite loop out of the process?
 */
public class ConsRecurs {
	public ConsRecurs(int i) {
		this(i*1.0);
	}
	public ConsRecurs(double d) {
		this((int)d);
	}
	public static void main(String[] a) {
		System.out.println("About to construct...");
		new ConsRecurs(Math.PI);
		System.out.println("Hey, I'm still alive!");
	}
}