如何捕捉一个InterruptedException?详情请进
小弟写了个程序,想捕捉一个InterruptedException,但是没有实现,请高手帮我改一下,以实现catch(InnterruptedException ie)中的语句
public class SL275 implements Runnable
{
public static void main(String[] args)
{
SL275 s=new SL275();
Thread t=new Thread(s);
t.start();
}
public void run()
{
try
{
Thread.sleep(1000);
Thread.interrupted();
}
catch(InterruptedException ie)
{
System.out.println("catch an interruptedexception");
}
finally
{
System.out.println("Implement Runnable Interface");
}
}
}