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

What is overloading and overriding in java?

664


Can we overload final method in java?

557


When super keyword is used?

600


Is 0 an even number?

557


Can we override final method?

571






how to create constants in java?

612


Explain why wait(), notify() and notifyall() methods are in object class rather than in thread class?

565


What is an array in java?

644


What are the 2 types of java programs?

568


Is it possible to compare various strings with the help of == operator? What are the risks involved?

624


Outline the major features of java.

569


What is the final class?

552


What is a variable declaration?

531


Explain about the performance aspects of core java?

558


What sorting algorithm does javascript use?

531