Defining a thread
Class HelloThread extends Thread{
public void run() {
try {
Thread.sleep((int)(Math.random()*3000));
}
Catch (InterruptedException e) {
System.err.println(e.toString());
}
System.out.println(“Hello “ + getName());
}
}
Previous slide
Next slide
Back to first slide
View graphic version