class s extends Thread{int j=0; public void run() { try{Thread.sleep(5000);} catch(Exception e){} j=100; } public static void main(String args[]) { s t1=new s(); t1.start(); System.out.println(t1.j); } } what you have to do to ensure that 'j' will print 100 a you have make t1 as Daemon Thread b You have join the t1 to main c You have to suspend the main when the thread starts and resume it after d the value of 'j' is set to 100 e You have to interrupt the main thread Ans is "b", Why? and why not "c"
Hades Suspend and resume are both deprecated methods. Using join you can ensure the main thread does not continue running until after the t1 has completed. hope that helps
------------------ Dave Sun Certified Programmer for the Java� 2 Platform