Finding Thread info in Java | Core Java Tutorials

This “Finding Thread Info in Java” page is providing information clearly about how to find information of thread like name and priority using pre-defined methods.

core-Java-online-Training-4

Current Thread information:

  • We can find thread info easily from non static context.
  • Following example shows how to find thread info like Name and Priority.

 

  • Finding thread information from static context.
  • Main is a thread but static context.
  • To get the information of main thread we use following method.

 

public static Thread currentThread()

  • Returns a reference to the currently executing thread object.

core-Java-online-Training-4

Share this