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

Given:

and

and

Which code, when inserted at one or more marked position, would allow classes B and C to compile?

    Correct Answer: D

    To allow classes B and C to compile, we need to ensure that all abstract methods from interfaces and abstract classes are implemented. In this scenario, class C must implement the abstract method z() from class B. The method x() from interface A does not need to be implemented in class C because it is already implemented in class B as a concrete method. Therefore, adding the implementation for method z() in class C will make both classes compile correctly.

Discussion
dillemanOption: D

D is correct. C is not correct since void x is public in Class B and has a weaker privilege in class C so this wont compile.

cathDevOption: D

D is correct . C is not correct. method x needs to be public not private package

ASPushkinOption: D

see my answer below

SampsOption: C

C is the correct answer. tricky as method x() with weaker access is part of option B and not C.

d7bb0b2Option: D

C => is incorrect x() can't has weaker access privileges D= > only needs implement z because in superclass is abstract in position /*1 *! nothing is need

ASPushkinOption: D

answer : D class C implements interface A And method x() comes from class B abstract class B { public void x() {} public abstract void z(); } class C extends B implements A { public void z() {} } -------- C is wrong method x() in class C can not has weaker access privileges A and B are wrong too @Override on position 2 is not good There is no super class for class B

[Removed]Option: C

C is correct as C needs to override both z() and x()

StavokOption: C

C is Correct TESTED

KiraguJohnOption: B

Answer is B

Adel2023

answser is D