thread_currentthread.htm
Objectives :
  • currentThread().getName())
  • Thread.currentThread().getId())
  • Thread.currentThread().getPriority())
  • Thread.currentThread().hashCode())
  • Thread.currentThread().isAlive())
 

//import java.lang.reflect.*;
import java.io.*;
import java.net.*; // for datagram
public class Test_this {
static public void main( String[] args )throws IOException
{
thread_this t = new thread_this();
t.process_thread();
} }
class thread_this extends Thread {
public static void process_thread()
{
//Thread.currentThread().getName();
System.out.println ("Thread getName() " + Thread.currentThread().getName());
System.out.println ("Thread getId() " + Thread.currentThread().getId());
System.out.println ("Thread getPriority() " + Thread.currentThread().getPriority());
System.out.println ("Thread hashCode() " + Thread.currentThread().hashCode());
System.out.println ("Thread toString() " + Thread.currentThread().toString());
System.out.println ("Thread isAlive() " + Thread.currentThread().isAlive());
}

}