1. Write a program to display the name of thread while executing the main() method.
Solution
class ShowMyName{
public static void main(String[] args){
String threadName = Thread.currentThread().getName();
System.out.println("The name of current thread is "+threadName);
}
}
after compilation, run the program and see the result as follows:
prompt>java ShowMyName
The name of current thread is main
Solution
class ShowMyName{
public static void main(String[] args){
String threadName = Thread.currentThread().getName();
System.out.println("The name of current thread is "+threadName);
}
}
after compilation, run the program and see the result as follows:
prompt>java ShowMyName
The name of current thread is main
I have read your blog its very attractive and impressive. I like it your blog.
ReplyDeleteJava Training in Chennai Java Training in Chennai | Core Java Training in Chennai | Java Training Institutes
Online Java Training Java Online Training | Java J2EE Online Training | JavaEE Training Institute in Chennai