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...


Why sleep()is in Thread and wait() in Object class? Why can't
I have both in one class or vice versa?



Why sleep()is in Thread and wait() in Object class? Why can't I have both in one class or vic..

Answer / ismail

In Java "Object" class is super for all classes and every
entity we consider as object in java. Every object in java
has default behaviour of "Object" class.

Now come to the point, When you instantiate a thread you
may require to stop a while that particular thread.So
Thread class has sleep method.

But in the situation of multithreading, you may require wait
() and notify() methods so that you can invoke "Object"
class behavior to your class.

Is This Answer Correct ?    7 Yes 3 No

Post New Answer

More Core Java Interview Questions

Is object a data type in java?

0 Answers  


What are encapsulation, inheritance and polymorphism?

0 Answers  


Which is the class in java?

0 Answers  


what is singlton class?where it is use in real time senario.

1 Answers   Wipro,


What are Transient and Volatile Modifiers?

3 Answers   SAP Labs, TUP Manila,


What is meant by null and void?

0 Answers  


Have you ever used hashtable and dictionary?

0 Answers  


Is hashset ordered?

0 Answers  


What is the use of parse function in java?

0 Answers  


Explain the key functions of data binding?

0 Answers   Akamai Technologies, Aspire, Impetus, Infogain, Tavant Technologies, Virtusa,


What are other modifiers?

2 Answers   Wipro,


I have a sorting issue with a Hashmap. My constraint is that I MUST use the Hashmap and work with existing code. I do a database query and place the results in a Hashmap. When I iterate thru the Hashmap, it loses the original alphabetical sorting done by the database. So, my problem is that I must sort the results coming out of the Hashmap which is then placed into another class.

1 Answers  


Categories