Advertisement
angrymasteryoda

apples.class

Jan 29th, 2012
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.38 KB | None | 0 0
  1. import java.util.Random;
  2.  
  3. public class apple implements Runnable{
  4.    
  5.     String name;
  6.     int time;
  7.     Random r = new Random();
  8.    
  9.     public apple(String s){
  10.         name= s;
  11.         time = r.nextInt(999); 
  12.     }
  13.    
  14.     public void run(){
  15.         try{
  16.             System.out.printf("%s is sleeping for %d\n, name, time");
  17.             Thread.sleep(time);
  18.             System.out.printf("%s is done\n", name);
  19.         }catch(Exception e){}
  20.     }
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement