Java Reference
In-Depth Information
strates
Runnable
,
Thread(Runnable
runnable)
,
currentThread()
,
getName()
, and
start()
.
Listing 4-17.
A pair of counting threads
class CountingThreads
{
public static void main(String[] args)
{
Runnable r = new Runnable()
{
@Override
public void run()
{
String
name
=
Thread.currentThread().getName();
int count = 0;