previous |
start |
next
GreetingThread
- We can get the date and time by constructing a Date object
Date now = new Date();
- To wait a second, use the sleep method of the Thread class
sleep(milliseconds)
- A sleeping thread can generate an InterruptedException
- Catch the exception
- Terminate the thread
previous |
start |
next