// First attempt to implement continuations and closures in Java

class cont {
	void f() {}; 
	closure cl;
	public cont() {
		System.out.println("do null conts make sense?");
	}
	public cont(closure c) { cl = c; }
}

class closure {
	int join;
}

class intClosure extends closure {
	int x,y;
	public intClosure() {join = 2;}
	public intClosure(int i, int j) {
		join = 2;
		x = i; y = j;
	}
}

class addCont extends cont {
	intClosure cl;
	public addCont(intClosure c) {cl = c; }
	void f() {
		System.out.println("newf says " + cl.x + cl.y);
	}
}

class ctest {
	public static void main(String args[]) throws java.io.IOException {
		System.out.println("testing continuation");

		intClosure cl = new intClosure(2,3);
		addCont c = new addCont(cl);

		c.f();
	}
}
