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

Given:

What is the result?

    Correct Answer: C

    The code does not compile because the final variable 'value' is not initialized in every constructor. In Java, a final variable must be initialized at the time of declaration or in every constructor. Since the default (no-argument) constructor 'public Price()' does not initialize the final variable 'value', the compilation fails.

Discussion
StavokOption: C

Correct answer is C public Price() {}: The blank final field value may not have been initialized

d7bb0b2Option: C

C is correct, final variable not initialized when is created, must be initialialized in every contructor or call this() other constructor that do it

OmnisumemOption: C

Tested C. "invalid method declaration; return type required" lines: 3, 5 and 7.

[Removed]Option: C

There's no constructor with zero arguments.

[Removed]

My bad. It doesn't compile because the final variable must be set in every constructor.

tmuralimanoharOption: C

Answer: C

ObaltOption: C

Correct answer is C