[2057] in java-interest

home help back first fref pref prev next nref lref last post

Re: thread.sleep and java.lang.InterruptedException

daemon@ATHENA.MIT.EDU (Larry Reu)
Fri Sep 22 15:13:27 1995

Date: Fri, 22 Sep 1995 08:55:33 -0700 (PDT)
From: Larry Reu <larryr@CyberGate.COM>
To: Janet Coursey <Janet.Coursey@Central.Sun.COM>
Cc: java-interest@java.Eng.Sun.COM, Janet.Coursey@Central.Sun.COM
In-Reply-To: <9509220003.AA18821@sw.Central.Sun.COM>

On Thu, 21 Sep 1995, Janet Coursey wrote:

> In the JDK prebeta1 , I get this compiler error:
> 
> 	javac Foo.java
> 	Foo.java:11: Warning: Exception java.lang.InterruptedException must be caught, or it must be  
> declared in throws clause of this method.
> 	        thread.sleep(150);

you can try something like:
 public void run()
 {
   try
   {
     thread.sleep(150);
   }
   catch (java.lang.Exception e)
   {
      System.out.println("got exception");
      //do other stuff
   }
 }

this of course catchs all exceptions you can just catch
the one you may expect, etc, etc.

.....................larry
-
Note to Sun employees: this is an EXTERNAL mailing list!
Info: send 'help' to java-interest-request@java.sun.com

home help back first fref pref prev next nref lref last post