Why sleep()is in Thread and wait() in Object class? Why can't
I have both in one class or vice versa?
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 |
When is the finalize() called?
what is Assertion?
What is pojo class in java?
What is the difference between serial and throughput garbage collector?
what is diffrence between .NET and java?
Can we have try block without catch block?
When does a class need a virtual destructor?
how to transactions(Bank transactions) in business process in ejb?
What happens if we don’t define serial version uid?
Where are global variables stored?
What are the differences between string and stringbuffer?
Can we overload the constructors?