3 public class sleep extends Thread {
5 public sleep (String name) {
10 Random random = new Random();
13 for (int i = 0; i < 10; ++i) {
14 System.out.println(getName());
15 sleep((long)(random.nextFloat() * 1000));
17 } catch (Exception exc) {
18 System.out.println("Exception: " + exc);
22 public static void main (String args[]) {
23 sleep t1 = new sleep("a");
24 sleep t2 = new sleep("b");