Which approach implements these requirements?

You are asked to create a Dog class that exposes the Dog class String name and int breed to
other code as read-only attributes, provides encapsulation, and adheres to the standard
JavaBeans naming conventions.
Which approach implements these requirements?

You are asked to create a Dog class that exposes the Dog class String name and int breed to
other code as read-only attributes, provides encapsulation, and adheres to the standard
JavaBeans naming conventions.
Which approach implements these requirements?

A.
Provide public name() and public breed() methods in the Dog class, and mark the name and
breed instance variables private.

B.
Provide private getName() and private getBreed() methods in the Dog class, and mark the
name and breed instance variables
private.

C.
Provide public getName() and public getBreed() methods in the Dog class, and mark the name
and breed instance variables private.

D.
Provide private name() and private breed() methods in the Dog class, and mark the name and
breed instance variables public.

E.
Provide public getName()/setName() and public getBreed()/setBreed() methods in the Dog
class, and mark the name and breed
instance variables private.



Leave a Reply 0

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