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
Is passing by reference faster?
How to make a non daemon thread as daemon?
How many bits are used to represent unicode, ascii, utf-16, and utf-8 characters?
What is the += operator called?
What do you mean by access modifier?
How many threads does a core java have?
Why you should not use singleton?
Is string pool garbage collected?
What is the difference between superclass and subclass?
What do you mean by stack?
Write a program to find the whether a number is an Armstrong number or not?
Can a constructor be made final?
In how many ways we can create threads in java?
What is native method in java?
Which is better stringbuffer or stringbuilder?