Source of Quote.java


  1: public class Quote extends Thread {
  2: 
  3:     protected int value;
  4: 
  5:     public Quote(int init) {
  6:         value = init;
  7:     }
  8: 
  9:     public void run() {
 10:         try {
 11:             for  (;;) {
 12:                 System.out.println(value);
 13:                 value += (Math.random() - 0.4) * (10.0 * Math.random());
 14:                 sleep(100);
 15:             }
 16:         } catch (InterruptedException e) {}
 17:     }
 18: 
 19:     public static void main(String[] args) {
 20:         new Quote(100).start();
 21:     }
 22: }