Java Thread.toString()
Syntax
Thread.toString() has the following syntax.
public String toString()
Example
In the following code shows how to use Thread.toString() method.
/* w ww .j av a2 s.c o m*/
class ThreadDemo implements Runnable {
ThreadDemo() {
Thread t = new Thread(this);
t.start();
}
public void run() {
System.out.println(t.toString());
}
}
public class Main {
public static void main(String[] args) {
new ThreadDemo();
}
}