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   SiteMap shows list of All Categories in this site.
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 ?    2 Yes 6 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 5 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 ?    17 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 ?    6 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 ?    3 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 ?    5 Yes 0 No
Ankush Sharma
 
  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
# 7
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 ?    4 Yes 0 No
Ss
 

 
 
 
Other Core Java Interview Questions
 
  Question Asked @ Answers
 
is there any function in java to make the text to blink?  5
what is difference between String buffer and String builder? Benchmark2
Marker interface means , interface which has no methods.Then what is the necessity of its usage.I read "it tells the compiler that it should be treated differently ". "It is used to store state of an object". But still am not clear.Please explain clearly.  1
Can applet in different page/s communicate with each other?  1
why the constructor should be used in class,if there is no constructor what will happen?  4
What is JIT ? Satyam4
How can you say HashMap is syncronized? IBM13
What is the Set interface?  2
Q1.A. Write note on “The class path Environment Variable”? B. Which are different kinds of source code? Q2.A. How to create an interface? B. Why convert an applet to an application? Q3.A. How to use Media tracker Class. B. How to use string tokenizer class. Q4 A. Explain the overview of UDP messaging. B. Difference between SQL Exception class and SQL Warning class. Q5. A. How to create com object in Java? B. Write short notes on “The properties class” Q6. A. When object is created and destroyed? B. Explain the JDB in depth & command line. C. Write short notes on Web Sites. iGate2
what is aberivation of java?  10
question on Thread synchronization Huawei1
How many bits are allocated to represent character of character sets - Unicode, ASCII, UTF-16, UTF-8?  1
if i have one string class then how can you achive this class functionality of this class? Fidelity3
what is java  9
What do you mean by the term transient? Ericsson4
What is the need of "creating and throwing an UserdefinedException" when the "Exception" class is already available?  4
If your team member writes code with lots of static variables and static methods, will it cause any side effects? KPIT1
What is a super class and how super class be called?  3
Does Java support multiple Inheritance?  6
What is the Layout for ToolBar?  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