?

AP® Computer Science A

Free Version

Upgrade subject to access all content

Moderate

When to Create a Method That Does Not Return a Value

APCSA-GVFVVJ

For which of the following situations would it be recommended to create a method that does not return a value (i.e. the method has a void return type)?

A

The method's only function is to update class variables

B

The class does not store any data and the private method’s purpose is to calculate a tax rate

C

The method is only called from within the class it is defined

D

The method is a global function that takes a parameter and multiplies it by a quantity

E

The method can provide a variety of results