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
What are the Static and Dynamic Variables? Differentiate them.
Explain the difference between call by refrence and call by value?
Can a static method be final?
What is an infinite loop? How infinite loop is declared?
Difference between comparator and comparable in java?
What is an empty list in java?
Can I declare class as static or private?
Why wait and notify methods are declared in object class?
Tell some latest versions in JAVA related areas?
What is the difference between the file and randomaccessfile classes?
Can we use switch statement with strings?
Compare overloading and overriding?
can I implement my own start() method? : Java thread
Can a method be static?
What is import java util arraylist?