இது பற்றிய வீடியோவை இங்கே காணலாம்.
package mainthreaddemo;
/**
*
* @author GOD
*/
public class MainThreadDemo {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
Thread t=Thread.currentThread();
System.out.println("The Current thread:"+t);
t.setName("MainThread");
System.out.println("The Current thread name after name change :"+t);
System.out.println("The Current thread is going to sleep for 10 seconds");
try
{
t.sleep(10000);
}
catch(InterruptedException e)
{
System.out.println("main thread interrupted");
}
System.out.println("After 10 seconds the current thread is exiting now");
}
}
-நன்றி
முத்து கார்த்திகேயன், மதுரை.
நிரலின் சோர்ஸ் கோட்.
package mainthreaddemo;
/**
*
* @author GOD
*/
public class MainThreadDemo {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
Thread t=Thread.currentThread();
System.out.println("The Current thread:"+t);
t.setName("MainThread");
System.out.println("The Current thread name after name change :"+t);
System.out.println("The Current thread is going to sleep for 10 seconds");
try
{
t.sleep(10000);
}
catch(InterruptedException e)
{
System.out.println("main thread interrupted");
}
System.out.println("After 10 seconds the current thread is exiting now");
}
}
-நன்றி
முத்து கார்த்திகேயன், மதுரை.
No comments:
Post a Comment