线程问题:3问题
问题1: 哪种方式好?
<1>
try {
for (int i = 5; i > 0; i--) {
System.out.println("Child Thread: " + i);
Thread.sleep(150);
}
} catch (InterruptedException e) {
System.out.println("Child interrupted.");
}
=============================================================================
<2>
for (int i = 5; i > 0; i--) {
System.out.println("Child Thread: " + i);
try {
Thread.sleep(150);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
------解决方案--------------------