Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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

What are the Static and Dynamic Variables? Differentiate them.

1158


Explain the difference between call by refrence and call by value?

1073


Can a static method be final?

1107


What is an infinite loop? How infinite loop is declared?

1168


Difference between comparator and comparable in java?

1159


What is an empty list in java?

1028


Can I declare class as static or private?

1010


Why wait and notify methods are declared in object class?

1084


Tell some latest versions in JAVA related areas?

1040


What is the difference between the file and randomaccessfile classes?

1159


Can we use switch statement with strings?

1089


Compare overloading and overriding?

1056


can I implement my own start() method? : Java thread

1038


Can a method be static?

1019


What is import java util arraylist?

1239