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?

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 cacess modifier of the SerRadius ( ) method to be protected.

C.
Add the following method: public double getArea ( ) {area = Match.PI * radius *
radius; }

D.
Change the getArea( ) method as follows: public double getArea ( ) { return
Match.PI * radius * radius; }



Leave a Reply 0

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