class mythread extends Thread {
public void run() {
// TODO Auto-generated method stub
super.run();
while (true) {
try {
Thread.sleep(500);
} catch (InterruptedException e) {
// TODO: handle exception
e.printStackTrace();
}
System.out.println("extends: " + Thread.currentThread().getName());
}
}
}
class mythread1 implements Runnable {
public void run() {
// TODO Auto-generated method stub
while (true) {
try {
Thread.sleep(400);
} catch (InterruptedException e) {
// TODO: handle exception
e.printStackTrace();
}
System.out.println("runnable: " + Thread.currentThread().getName());
}
}
}
04-03