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 collable collections in java?
What is I/O Filter?
Given: 1. package test; 2. 3. class Target { 4. public String name = “hello”; 5. } What can directly access and change the value of the variable name? 1 any class 2 only the Target class 3 any class in the test package 4 any class that extends Target
Explain purpose of sleep() method in java?
explain the clone method and clonable interface
What is an accessor?
What is the use of 'super' keyword inside a constructor?
0 Answers Flextronics, Thomson Reuters, Virtusa,
How is it possible for two string objects with identical values not to be equal under the == operator?
difference between byte stream class and character stream class?
What is constructor chaining and how is it achieved in java?
What is "this" keyword in java? Explain
What does method mean?