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


Please Help Members By Posting Answers For Below Questions

Can inner class have constructor?

537


does java support pointers?

556


Difference between java and javascript

579


Hi Anyone know the model / questions of the Federal bank sample questions for the post of Specialist Officers - Programmers. Please post if anyone have..

1809


Which is better stringbuilder or stringbuffer?

521






What is java oops?

549


What does %4d mean in java?

835


Lowest Common ancestor in a Binary Search Tree and Binary Tree.

549


What is the difference between abstract classes and interfaces?

501


Can inner class be public in java?

538


What is a method in java?

549


what is collatration?

2735


What are design patterns and please explain?

564


Is final static java?

538


What is difference between equal and == in java?

514