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

Given:

and

What is the result?

    Correct Answer: E

    The compilation fails because the setValue method in the MyType class requires the type to be specified. The line 'type.setValue(1234)' tries to set an integer value to 'type', which is of type 'MyType<?>', leading to a compilation error since the compiler cannot ensure that the type parameter matches the given value type.

Discussion
StavokOption: E

E is correct The method setValue(capture#1-of ?) in the type MyType<capture#1-of ?> is not applicable for the arguments (int)

ASPushkinOption: E

MyClass.java:19: error: incompatible types: int cannot be converted to CAP#1 type.setValue(1234); ^ where CAP#1 is a fresh type-variable: CAP#1 extends Object from capture of ? Note: Some messages have been simplified; recompile with -Xdiags:verbose to get full output 1 error

ObaltOption: E

Correct answer is E