Exam 1z0-819 All QuestionsBrowse all questions from this exam
Question 180

Given:

and

What is the result?

    Correct Answer: B

    The provided enums cannot be instantiated manually because enums in Java are implicitly final and cannot be extended. The line 'return new Status(20);' inside the addStatus method tries to instantiate the enum, which is not allowed. This violates the rules of enum instantiation; hence, the compilation will fail.

Discussion
ASPushkinOption: B

Several syntax errors here But main thing is return new Status(20); error: enum classes may not be instantiated You cannot invoke an enum constructor yourself !!! Even if the constructor package access modifier allows it

d7bb0b2Option: B

return new Status(20); => Enum types cannot be instantiate