Someone asked me this question in an interview. I am not sure if it is a valid question or not. If it is please reply. Thanks
Asked
Active
Viewed 56 times
0
-
Can there be a situation where you want to "wait" on a specific instance of an object? Think about it... ;) – vikingsteve Dec 03 '19 at 09:39
-
1Does this answer your question? [Concept behind putting wait(),notify() methods in Object class](https://stackoverflow.com/questions/17840397/concept-behind-putting-wait-notify-methods-in-object-class) – Sasikumar Murugesan Dec 03 '19 at 09:39
-
I just wonder which interview you were asked this question. – aydinugur Dec 03 '19 at 09:42
1 Answers
6
java.lang.Class
implictly extends java.lang.Object
, like every other object type, so it inherits both this methods from Object
:
Class<?> clazz = new Object().getClass();
clazz.wait();

Karol Dowbecki
- 43,645
- 9
- 78
- 111