What prevents this code from compiling?

Given:

What prevents this code from compiling?
A. The calculateSurfaceArea method within Cylinder must be declared default.
B. Cylinder is not properly calling the Rectangle and Ellipse interfaces’ calculateSurfaceArea methods.
C. Cylinder requires an implementation of calculateSurfaceArea with two parameters.
D. The calculateSurfaceArea method within Rectangle and Ellipse requires a public access modifier.

Download Printable PDF. VALID exam to help you PASS.

One thought on “What prevents this code from compiling?

  1. B is correct.

    Duplicate default methods named calculateSurfaceArea with the parameters (double, double) and (double, double) are inherited from the types Ellipse and Rectangle

    Note: if the class already has the same method as an Interface, then the default method from the implemented Interface does not take effect. However, if two interfaces implement the same default method, then there is a conflict.

    1
    4

Leave a Reply

Your email address will not be published. Required fields are marked *


The reCAPTCHA verification period has expired. Please reload the page.