• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 316
  • Last Modified:

Java: how to assign name to thread... when implementing runnable?

Hello Experts,

how do I assign a name to a thread when implementing runnable?

public class Test implements Runnable {

}

Thanks for your help experts,

regards
0
epifanio67
Asked:
epifanio67
1 Solution
 
CPColinSenior Java ArchitectCommented:
Hi epifanio67,

You can either call setName() on the thread when you create it or call Thread.currentThread().setName() at the start of your run() method.
0
 
epifanio67Author Commented:
thank you expert...
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now