AP® Computer Science A

Free Version

Upgrade subject to access all content

Moderate

Non-Static vs Static Methods

APCSA-JVN7KA

Which of the following are good reasons for defining a method as non-static instead of static?

I. The method is a pure function that does not modify any instance variables in the class
II. The method needs to refer to non-static variables in the class
III. The method’s functionality applies to instances of the class
IV. When you prefer to call the method from other classes without creating a new object from the class

A

I and IV only.

B

II and III only.

C

I, II, and III only.

D

II, III, and IV only.

E

III and IV only.