C:\jdk\bin>javac Revolve.java
Revolve.java:46: Exception java.lang.InterruptedException must be caught, or i
must be declared in the throws clause of this method.
try {Thread.sleep(10000); }
^
Revolve.java:47: Class InterrupterException not found in type declaration.
catch(InterrupterException e) {}异常写错了
应该是InterruptedException
Revolve.java:46: Exception java.lang.InterruptedException must be caught, or i
must be declared in the throws clause of this method.
try {Thread.sleep(10000); }
^
Revolve.java:47: Class InterrupterException not found in type declaration.
catch(InterrupterException e) {}异常写错了
应该是InterruptedException
写成:InterrupterException
了。请看你的代码:
public void run () {
while(true) {
repaint();
current++;
if(current>2)
current=0;
try {Thread.sleep(10000); }
catch(InterrupterException e) {}//这里,嘿嘿
}
要扑捉异常
try{
runner.stop();}catch(Exception e){
}
catch(Exception e) {}/