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

Given:

Which is true?

    Correct Answer: C

    The provided code sample makes use of features that are valid in Java interfaces as of Java 8. These features include default methods and static methods. The 'tare()', 'net()', and 'gross()' methods are properly defined with the 'default' keyword, allowing them to have implementations within the interface. The 'toUnit()' method is declared as 'private static', which is also a valid declaration within an interface to hide the implementation details from the implementing classes. 'public static final' variables are also allowed in interfaces. Thus, the code compiles without errors.

Discussion
OmnisumemOption: C

Tested: C.

d7bb0b2Option: C

NO ERRORS IN CODE

dillemanOption: C

C, tested

KiraguJohnOption: C

C since static methods are allowed in an interface same as default methods and public static final variables