Get information of main(default) thread

package threaddemo;
public class MainThreadDemo {
	public static void main(String[] args) 
	{
	Thread th1=Thread.currentThread();
	System.out.println(th1);
	th1.setName("My thread");
	th1.setPriority(9);
	System.out.println(th1);
	System.out.println(th1.getName());
	System.out.println(th1.getPriority());
}
}

Download

Thread Source Code

Thread by extending Thread class
Thread by implementing Runnable interface
Multithread by implementing Runnable interface
Thread Intercommunication
Thread Join Example
Thread Join Example
Main Thread information
Multithreaded Example
Thread Priority
Thread Priority
Thread yield example


Write your Comment

Name :
Email Id : [ We will not publish your email id ]
Your Comment : [ Maximum 200 chars ]
Enter Security code