public class simple {
	public simple(){
		SimpleThread st1 = new SimpleThread();
        Thread t1 = new Thread(st1);
        t1.setName("prva");
        t1.start();
        
        SimpleThread st2 = new SimpleThread();
        Thread t2 = new Thread(st2);
        t2.start();
        t2.setName("druga");
        
        try{
        	t1.join();
        	t2.join();
        	System.out.println("Dretva 1 vratila je " + st1.number);
        	System.out.println("Dretva 2 vratila je " + st2.number);
        }
        catch(Exception e){
        	System.out.println("Greska prilikom cekanju:" + e);
        }        
	}
	
    static public void main(String args[]) {                
    	new simple();
    }
    
	public class SimpleThread implements Runnable{		
		public int number;
		public SimpleThread(){
		}
		public void run(){		    
  			number=(int) (100000 *Math.random());	  
  			System.out.println("Ime dretve:" + Thread.currentThread().getName() + " broj: " + number);
			
		}
	}
	    
     
}