Originally posted by laoniu gougou:
class MyThread extends Thread{
String str;
public MyThread(String s){str = s;}
public void run(){System.out.println(str);}
public static void main(String args[])
{
MyThread s1 = new MyThread("t1");
MyThread s2 = new MyThread("t2");
s1.start();
s2.start();
System.out.println("Main");
}
1)Could the output Main before t1/t2, or Main is definitely after
t1/t2 (t1, t2 order can not be determined)?
2)Can anybody explain whether main() method is not running in a Thread or not? If it is, what is its priority?
<UL TYPE=SQUARE><I><LI>Ryan Burgdorfer<BR><LI>Java Acolyte</I></UL>
Associate Instructor - Hofstra University
Amazon Top 750 reviewer - Blog - Unresolved References - Book Review Blog
Did you see how Paul cut 87% off of his electric heat bill with 82 watts of micro heaters? |