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();
  }

}




















Home »
  Java Tutorial »
    java.lang »




Boolean
Byte
Character
Class
Double
Enum
Float
Integer
Long
Math
Number
Object
Package
Process
ProcessBuilder
Runnable
Runtime
SecurityManager
Short
StackTraceElement
StrictMath
String
StringBuffer
StringBuilder
System
Thread
ThreadGroup
ThreadLocal
Throwable