What change is needed to make MyClass well encapsulated?
import java.util.*; public class MyClass { private int number = new Random().nextInt(10); public boolean guess(int candidate) { return number == candidate; } }
D.
This class is a good example of encapsulation.
It has a private instance variable and is accessed by a public method.
No changes are needed to encapsulate it, and Option D is correct.