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 / ankush sharma

We can check the current Thread name as
Thread t= new Thread.currentThread();
System.out.println(t.getName());

Is This Answer Correct ?    11 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

how does the run() method in runnable work? : Java thread

518


What is a flag variable?

563


Tell me the Importent classes in net package?

1586


What is regex in java?

531


What is the difference between == and === javascript?

579






Can a static block throw exception?

660


What do you mean by compiler?

587


what is the constructor and how many types of constructors are used in java?

539


What is backdrop?

601


What is runtime polymorphism or dynamic method dispatch?

526


Can you call one constructor from another if a class has multiple constructors?

590


Why char array is favored over string for the storage of passwords?

561


What do you mean by an object in java?

636


What does it mean that a method or field is “static”?

553


What are parameters in a method?

587