forを使わずカウントダウン
2007/02/21
java
forを使わずカウントダウン。。。
package interfacetest;
public class TestMainForI {
public static void main(String[] args) {
final int i = 177;
A a = new A(){
int ii = i;
public A exec() {
System.out.println(ii);
ii = ii -1;
if(ii < 0) return null;
return this;
}
};
class Exec {
public A exec(A a){
if((a= a.exec()) != null){
return exec(a);
}
return null;
}
}
new Exec().exec(a);
}
interface A {
public A exec();
}
}
: