public void run() {
for (int i = 0; i < 10; i++)
{
System.out.println(s);
try {
Thread.sleep(100);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
}
然后在main中启动多线程
public static void main(String[] args) {
/*Cus c = new Cus();
Thread t1 = new Thread(c);
Thread t2 = new Thread(c);
// new Thread(c).start();
t1.start();
t2.start();*/
new Thread(new ThreadPrint("haha")).start();
new Thread(new ThreadPrint("heihei")).start();
new Thread(new ThreadPrint("wawa")).start();
}