Which two modifications are necessary to ensure that the class is being properly encapsulated?

Given:


The class is poorly encapsulated. You need to change the circle class to compute and return the area instead.
Which two modifications are necessary to ensure that the class is being properly encapsulated?
A. Remove the area field.
B. Change the getArea( ) method as follows:
public double getArea ( ) { return Match.PI * radius * radius; }
C. Add the following method:
public double getArea ( ) {area = Match.PI * radius * radius; }
D. Change the cacess modifier of the SerRadius ( ) method to be protected.

Download Printable PDF. VALID exam to help you PASS.

Leave a Reply

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


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