Thread
Class Thread Implemented Interface:Runnable.
A thread ia a thread of execution in a program. The Java Virtual Machine allows an application to have multiple threads of execution runing concurrently.
now look at this constructor:
public Thread (Runnable target)
Allocates a new Thread
object. This constructor has the same effect as Thread(null, target,
gname )
, where gname is a newly generated name. Automatically generated names are of the form "Thread-"+
n , where n is an integer.
this is the example:
new Thread(new Runnable() {
public void run() {
System.out.println(Thread.currentThread().getName() + " : " + ITL.get());
ITL.get().append(", wqf");
System.out.println(Thread.currentThread().getName() + " : " + ITL.get());
}
}).start();