/*******************PRODUCER************************/ class myRunnable implements Runnable { int value; public myRunnable(int startVal) { value = startVal; } public void run() { while(true) { System.out.println("value:" + value); try{Thread.sleep(400+value);} catch (InterruptedException e) {} value++; } } } // end class Producer public class Simple2 { public static void main (String args[]) { Thread Uno = new Thread(new myRunnable(0)); Thread Dos = new Thread(new myRunnable(2000)); Uno.start(); Dos.start(); try{Thread.sleep(10000);} catch (InterruptedException e) {} } }