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
What is parsing and its types?
What is the functionability stubs and skeletons?
How can an object be unreferenced?
What is variable declaration and definition?
What is the final method?
What is the difference between checked exception and unchecked exception?
What is singleton pattern?
What is a boolean used for?
What is the difference between logical data independence and physical data independence?
How can we access some class in another class in java?
How hashmap increases its size in java?
What is array length in java?
Is string passed by reference in java?
FOR EXAMPLE WE R HAVING TWO LIST ELEMENTS ..BOTH LISTS CONTAINS ID,NAME,PLACE ..I NEED TO COMPARE BOTH IDS IN TWO LISTS,IF ID'S R SAME MEANS WE HAVE ADD THE DETAILS(LIKE NAME,PLACE) TO MAP...HOW IS POSSIBLE ?CAN ANY ONE SUGGEST?
What is the difference between compile-time polymorphism and runtime polymorphism?