简体   繁体   中英

Why Object class has methods wait() and notify() and Class class does not have?

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

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();

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM