0

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

3
  • Can there be a situation where you want to "wait" on a specific instance of an object? Think about it... ;) Commented Dec 3, 2019 at 9:39
  • 1
    Does this answer your question? Concept behind putting wait(),notify() methods in Object class Commented Dec 3, 2019 at 9:39
  • I just wonder which interview you were asked this question. Commented Dec 3, 2019 at 9:42

1 Answer 1

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();
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.