?

AP® Computer Science A

Free Version

Upgrade subject to access all content

Easy

When to Make a Method Private

APCSA-NFLKNA

When designing a class, which of the following would be the BEST reason for making a method private?

A

When you do not want other programmers to change the method’s code.

B

When the method needs to be called from another class.

C

When the method returns a value that is helpful in other classes.

D

When the method is only useful in the class it is defined in.

E

When the other methods in the class are defined as private.