• Post Reply Bookmark Topic Watch Topic
  • New Topic

Thread Question  RSS feed

 
Shiva Mohan
Ranch Hand
Posts: 486
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,



In the above program,childchild (line1) is displaying when the child thread comes to execution.i want the same way mainmain string is to be displayed when the main thread comes execution.But here I couldn�t use super().then how can I get the result.Please help me to figure out how to solve this.
 
marc weber
Sheriff
Posts: 11343
Java Mac Safari
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If I'm understanding this correctly, you're trying to get to the name of the "main" program thread. You can get a reference to this thread by calling Thread.currentThread(). With that, you can get/set the name...
 
ak pillai
author
Ranch Hand
Posts: 288
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Set the thread name when you create a new thread and get the thread name when you want to print something.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!