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 / namita kapoor

You can check by putting following code in your program

Thread t = Thread.currentThread();
System.out.println("Current Thread: "+t);

Is This Answer Correct ?    36 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Which collections are thread safe in java?

471


Do we have pointers in java?

522


What steps are taken when the OS shifts from one-thread execution to another?

891


What is the purpose of sizeof operator?

524


what is the difference between a threads start() and run() methods? : Java thread

516






What are desktop procedures?

554


What is ordered map in java?

531


Variables used in a switch statement can be used with which datatypes?

507


Why javac is not recognized?

513


How to change the priority of thread or how to set the priority of thread?

609


What is the difference between reader/writer and inputstream/output stream?

547


Write a program to search a number in the given list of numbers.

622


What is an anonymous class in java?

536


Is arraylist zero based?

547


What is static import?

587