ALLInterview.com :: Home Page KalAajKal.com
 Advertise your Business Here     
Browse  |   Placement Papers  |   Company  |   Code Snippets  |   Certifications  |   Visa Questions
Post Question  |   Post Answer  |   My Panel  |   Search  |   Articles  |   Topics  |   ERRORS new
   Refer this Site  Refer This Site to Your Friends  Site Map  Bookmark this Site  Set it as your HomePage  Contact Us     Login  |  Sign Up                      
tip   To Refer this Site to Your Friends   Click Here
Google
 
Categories  >>  Software  >>  Core Java  >>  Java J2EE  >>  Java Related
 
 


 

 
 Core Java interview questions  Core Java Interview Questions
 Advanced Java interview questions  Advanced Java Interview Questions
 Swing interview questions  Swing Interview Questions
 EJB interview questions  EJB Interview Questions
 Servlets interview questions  Servlets Interview Questions
 Struts interview questions  Struts Interview Questions
 JDBC interview questions  JDBC Interview Questions
 JMS interview questions  JMS Interview Questions
 SunOne interview questions  SunOne Interview Questions
 J2EE interview questions  J2EE Interview Questions
 Weblogic interview questions  Weblogic Interview Questions
 Websphere interview questions  Websphere Interview Questions
 Java Networking interview questions  Java Networking Interview Questions
 Java J2EE AllOther interview questions  Java J2EE AllOther Interview Questions
Question
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 ?
 Question Submitted By :: Akj504
I also faced this Question!!     Rank Answer Posted By  
 
  Re: 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
# 1
Using Java Debugger "jdb" one gets information about
which thread currently executing threads
 
Is This Answer Correct ?    1 Yes 3 No
Chellammal
 
  Re: 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
# 2
but if I want check/findout within my program itself 
How do I do that ?
 
Is This Answer Correct ?    1 Yes 3 No
Akj504
[IT]
 
 
 
  Re: 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
# 3
You can check by putting following code in your program

Thread t = Thread.currentThread();
System.out.println("Current Thread: "+t);

 
Is This Answer Correct ?    7 Yes 1 No
Namita Kapoor
 
  Re: 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
# 4
Check executing/running current thread by

currentThread() [Method]

public static Thread currentThread() 

Find the currently executing thread. 

Returns: 

the currently executing thread
 
Is This Answer Correct ?    5 Yes 0 No
Adminraj
[Sun]
 
  Re: 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
# 5
by using currentThread() Method ,we can find which thread 
is runing
 
Is This Answer Correct ?    2 Yes 0 No
Srinivas
 
  Re: 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
# 6
We can check the current Thread name as 
Thread t= new Thread.currentThread();
System.out.println(t.getName());
 
Is This Answer Correct ?    2 Yes 0 No
Ankush Sharma
 

 
 
 
Other Core Java Interview Questions
 
  Question Asked @ Answers
 
Why do we use public static with the main function in Java? Infosys4
Difference between a Scrollbar and a ScrollPane?  1
define System.out.println(); what is the meaning!  5
where do we use init()  1
can we create a instance for intwerface?  2
what is difference between Action messages and Action errors? TCS1
Which is not Object in Java? Honeywell6
When does Exception occurs?  2
How the elements are organized in CardLayout?  5
What is static binding and where it occurs?  2
how session will be expired? Infosys4
what is the difference between statis block and static variable  5
What is file class and what is its purpose?  1
what is an object and how do you allocate memory to it? Wipro3
what is the use of custom tags? with example? Photon1
Can we override static methods? Bally-Technologies12
write java code to print second max number in the array Huawei4
int a=1; float b=1.0; System.out.println(a==b); Honeywell7
what Data encapsulation in java?  2
can we add two numbers without using arthematic operators? if possible how?  1
 
For more Core Java Interview Questions Click Here 
 
 
 
 
 
   
Copyright Policy  |  Terms of Service  |  Help  |  Site Map 1  |  Articles  |  Site Map  |   Site Map  |  Contact Us interview questions urls   External Links 
   
Copyright © 2007  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  Forum9.com   ::  KalAajKal.com