class ThreadDmoe extends Thread
{
public void run()
{
for (int x = 0;x<100 ; x++)
{
System.out.println(this.getName()+"Thread run"+x);
}
}
}
class ThreadTest
{
ThreadDemo t1 = new ThreadDemo();
ThreadDemo t2 = new ThreadDemo();
t1.start();
t2.start();
}
为什么没写主函数会是这样的呢?
ThreadDemo.java:16: 错误: 需要<标识符>
t2.start();
ThreadDemo.java:17: 错误: 需要<标识符>
t2.start();
|
|