package cn.jie.nets;
import java.io.*;
class StrThread implements Runnable {
String a;
StrThread(String a) {
this.a = a;
}
public void run() {
for (int i = 0; i < 5; i++) {
System.out.println(a);
}
}
}
public class Demo {
public static void main(String[] args) throws Exception {
// TODO Auto-generated method stub
while (true) {
String a = (new BufferedReader(new InputStreamReader(
System.in))).readLine();
Thread.sleep(5000);
new Thread(new StrThread(a)).start();
}
}
}
为什么这个程序输入,a回车b回车c回车它打印a五次,打印b五次,c不打印,我觉得应该是只打印c的 |
|