3 public class sleep_exception extends Thread {
4 public static Random r = new Random();
6 public sleep_exception (String name) {
11 for (int i = 0; i < 10; ++i) {
12 System.out.println(getName());
14 throw new Exception("Exception in thread");
15 } catch (Exception e) {
19 sleep((long) (r.nextFloat() * 1000));
20 } catch (Exception e) {
26 public static void main(String args[]) {
27 sleep_exception t1 = new sleep_exception("a");
28 sleep_exception t2 = new sleep_exception("b");