一个简单的线程问题
public class Xiancheng extends Thread
{
public static void main()
{
Thread read=new TryThread(163);
Thread read2=new TryThread2(2004);
read.setDaemon(true);
read2.setDaemon(false);
read.start();
read2.start();
public void run() //这里有问题吗?!为什么不能编译通过?!
{
try
{
for(int i=0;i<30;i++)
{
System.out.println(我是主线程);
}
}
catch(InterruptedException e)
{
System.out.println(e.toString());
}
}
}
}