public class Example15_1 {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
SpeakHello speakHello;
SpeakNinhao speakNinhao;
speakHello = new SpeakHello();
speakNinhao= new SpeakNinhao();
speakHello.start();
speakNinhao.start();
for(int i=1;i<=5;i++){
System.out.println("大家好"+i+"");
}
}
}
public class SpeakHello extends Thread {
public void run(){
for(int i=1;i<=7;i++){
System.out.println("hello"+i+"");
}
}
}
public class SpeakNinhao {
public void run(){
for(int i=1;i<=7;i++){
System.out.println("ninhao"+i+"");
}
}
}
speakNinhao.start();这个语句Myeclipse里面报错:The method start()is undefined for the type 'SpeakNinhao'.我发现即使在SpeakNinhao类里面写一个start()也不能通过编译。谁知道如何改