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

Is passing by reference faster?

982


How to make a non daemon thread as daemon?

1054


How many bits are used to represent unicode, ascii, utf-16, and utf-8 characters?

1089


What is the += operator called?

1044


What do you mean by access modifier?

1018


How many threads does a core java have?

1058


Why you should not use singleton?

963


Is string pool garbage collected?

989


What is the difference between superclass and subclass?

1164


What do you mean by stack?

1146


Write a program to find the whether a number is an Armstrong number or not?

1018


Can a constructor be made final?

1103


In how many ways we can create threads in java?

1202


What is native method in java?

1053


Which is better stringbuffer or stringbuilder?

909