If a multi threaded Java program has started numerous number
of threads, at any point in time how to know which thread is
currently executing/running ?
Answer Posted / ss
currentThread() method is static method, so don't need to
create the thread object to call the method..
Below is the correct way ..
Thread t=Thread.currentThread();
System.out.println(t.getName());
| Is This Answer Correct ? | 13 Yes | 0 No |
Post New Answer View All Answers
How many threads does a core java have?
Give any two differences between C++ and java.
How do weakhashmap works?
What are different types of constants?
Why singleton class is used in java?
What are wrapper classes in java?
How can you handle java exceptions?
What is the purpose of finalization in java programming?
What are aggregate functions explain with examples?
Is 0 an irrational number?
What is import java util arraylist?
What do you mean by Hash Map and Hash Table?
How does compareto work in java?
What is instance means in java?
Can singleton class be inherited in java?