Why does the first line work but not the second:
Class<? extends Class> c1 = (new Object()).getClass().getClass();
Class<? extends Class<? extends Class>> c2 = (new Object()).getClass().getClass().getClass();
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
From the API docs for
Object.getClassSo
(new Object()).getClass()will return aClass<? extends Object>. We’re going to callgetClasson that. So the X will beClass, which will give usClass<? extends Class>.