I tried to create a Model object:
ClassA classA = getClassA();
Model model = new Model(classA);
When I tried to compile it, the following compile error occurs:
cannot find symbol : constructor Model(ClassA)
Why wouldn’t ClassA be allowed here?
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.
You need to add a generic type to the model class.
Try this:
Without the generic type, Java can’t find an appropriate constructor, hence the error message.