我在网上找了个程序。
public class Test1 extends Thread{
static int count = 0;
int number;
public Test1(int num){
number = num;
}
public void run(){
while(count<30){
//synchronized(this){
count++;
//}
System.out.println ("线程"+number+":"+count);
}
}public static void main(String[] args){
for(int i=0; i<3;i++)
new Test1(i).start();-------->就是这句,请问这里的start()是什么意思呀,这个
}                  Test1类中没有这个意思呀
}

解决方案 »

  1.   

    start()是继承自Thread的方法,一执行这个方法就启动这个线程了,即执行Test的run()方法。
      

  2.   

    new Test1(i).start();它这一句中的Test1(i)是个成员函数,还是一个类呀
      

  3.   

    new Test1(i).start();同等于:
    Test1 t=new Test1();  //创建一个类成员对象 
    t.Test1(i=0 to 2)  //构造函数(方法),对类进行初始化// 不好意思,这里用到VB的数组,V            B的数组好懂些~~~
    t.start();   //启动线程~~~
      

  4.   

    t.Test1(i=0 to 2)  //构造函数(方法),对类进行初始化写错了~~
    下面才是对的
    t.Test1(i=0 to 2)  //构造函数(方法),对当前类进行初始化