public class Virus {
static int virusCount = 0;
public Virus() {
virusCount++;
}
static int getVirusCount() {
return virusCount;
}
}
public class VirusLook {
public static void main(String[] args) {
int numViruses = Integer.parseInt(args[0]);
if (numViruses > 0) {
Virus[] virii = new Virus[numViruses];
for (int i = 0; i < numViruses; i++) {
virii[i] = new Virus();
}
System.out.println("There are " + Virus.getVirusCount()
+ " viruses.");
}
}
}
为什么输入200能运行,2000000000000就不能运行 |