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 |
What is the method to expand and collapse nodes in a jtree?
Adapter classes?
How to optimize the javac output?
What are the types of literals?
How to create an instance of a class without using "new" operator? Plz help me out properly.Thank u.
hr interview how many minutes asking question
What are the names of Component subclasses that support painting?
What is ascii code?
What is stack explain?
is memory to the abstract class allocated ..or objects not instantiated
explain the concept of inheritance with an example?
What is the access scope of a protected method?