Click here to Skip to main content
15,891,372 members
Home / Discussions / Java
   

Java

 
QuestionThread names Pin
Neo101014-Oct-12 1:19
Neo101014-Oct-12 1:19 
AnswerRe: Thread names Pin
Nagy Vilmos4-Oct-12 2:54
professionalNagy Vilmos4-Oct-12 2:54 
Simply put you are addressing the Thread method not the MyThreadRunnable method. You could change your code thus and it would work as expected:

Java
MyThreadRunnable runnable = new MyThreadRunnable();
Thread thread = new Thread(runnable, "runnable1");
runnable.setName(thread.getName());
thread.start();



Panic, Chaos, Destruction. My work here is done.
Drink. Get drunk. Fall over - P O'H
OK, I will win to day or my name isn't Ethel Crudacre! - DD Ethel Crudacre
I cannot live by bread alone. Bacon and ketchup are needed as well. - Trollslayer
Have a bit more patience with newbies. Of course some of them act dumb - they're often *students*, for heaven's sake - Terry Pratchett

AnswerRe: Thread names Pin
Gowtham Gutha15-Nov-12 7:11
Gowtham Gutha15-Nov-12 7:11 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.