我正在尝试从 Java的艺术与科学一书中编写一些简单的代码。例如,我正在编写Liftoff
的代码,但是每次写extends ConsoleProgram
时都会遇到相同的错误。
import acm.program.*;
public class Countdown extends ConsoleProgram {
public void run() {
for (int t = START; t >= 0; t--) {
println(t);
}
println("Liftoff!");
}
private static final int START = 10;
}
我希望输出:
10
9
8
7
6
5
4
3
2
1
Liftoff