X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;ds=sidebyside;f=tests%2Fsleep.java;h=a93dbaf823e6f3efab95ca90190db1cd7aa1e0bc;hb=9f4c652dfe91e6cdd1da9031eae0c61dab696b29;hp=3aff12949401c835c7d81be9be283385afd43347;hpb=d60c13a2d504ddd6893faf0a4adfe653415f66e2;p=cacao.git diff --git a/tests/sleep.java b/tests/sleep.java index 3aff12949..a93dbaf82 100644 --- a/tests/sleep.java +++ b/tests/sleep.java @@ -1,25 +1,24 @@ import java.util.*; public class sleep extends Thread { + public static Random r = new Random(); public sleep (String name) { super(name); } public void run() { - Random random = new Random(); - - try { - for (int i = 0; i < 10; ++i) { - System.out.println(getName()); - sleep((long)(random.nextFloat() * 1000)); - } - } catch (Exception exc) { - System.out.println("Exception: " + exc); - } + for (int i = 0; i < 10; ++i) { + System.out.println(getName()); + try { + sleep((long) (r.nextFloat() * 1000)); + } catch (Exception e) { + e.printStackTrace(); + } + } } - public static void main (String args[]) { + public static void main(String args[]) { sleep t1 = new sleep("a"); sleep t2 = new sleep("b");