//定义一个继承Thread类的类,并覆盖run()方法,在run()方法中每隔100毫秒打印一句话
public class Csh extends Thread{ public void run(){
outInfo();
} private void outInfo() {
for(int i=0;i<21;i++){
System.out.println("我最聪明"); try {
Thread.sleep(100);
} catch (InterruptedException e) { e.printStackTrace();
}
} } public static void main(String[] args) { Csh m = new Csh(); m.start(); Csh n = new Csh();
n.start();
}
}