第1个回答 2017-03-15
public class Thread1 implements Runnable {
private int i = 0;
public void run() {
while(true){
i++;
if (i % 4 == 0) {
System.out.println("*******");
}
if (i>100) {
break;
}
}
}
}
import java.util.Date;
public class Thread2 implements Runnable {
public void run() {
while (true) {
try {
Thread.sleep(10000);
System.out.println(new Date().toLocaleString());
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
}public class Client {
public static void main(String[] args) {
Thread one = new Thread(new Thread1());
Thread two = new Thread(new Thread2());
one.start();
two.start();
}
}本回答被提问者采纳