class Coffee extends Thread{
public void run(){
while(true){
System.out.println("I like coffee.");
yield();
}
}
}
package doItMyself;
class Tea extends Thread{
public void run(){
while(true){
System.out.println("I like tea.");
yield();
}
}
}
public class Drinks {
public static void main(String[] args) {
Coffee c=new Coffee();
c.start();
new Tea().start();
}
}
如何让这个程序停下来啊,我试了Ctrl-C,不管用啊?
------解决方案--------------------
如果是在Eclipse下运行,点击Console view中的"Terminate"不就可以了嘛