我在网上找了个程序。
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类中没有这个意思呀
}
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类中没有这个意思呀
}
Test1 t=new Test1(); //创建一个类成员对象
t.Test1(i=0 to 2) //构造函数(方法),对类进行初始化// 不好意思,这里用到VB的数组,V B的数组好懂些~~~
t.start(); //启动线程~~~
下面才是对的
t.Test1(i=0 to 2) //构造函数(方法),对当前类进行初始化