What are two options for writing a called method that results in altering a single value in the calling method?

What will be an ideal response?


When you need a method to alter a single value, you have two options:
* Use a return type. You can send an argument to a method that accepts a value parameter, alter the local version of the variable within the method, return the altered value, and assign the return value to the original variable back in the calling method.
* Pass by reference. You can send an argument to a method that accepts a reference parameter or an output parameter, and alter the value at the original memory location within the method.

Computer Science & Information Technology

You might also like to view...

A typical time setting for turning the display off when a computer is plugged in is _____ minutes (for the Balanced power plan).

A. 5 B. 10 C. 15 D. 20

Computer Science & Information Technology

Which class do you use to write data into a text file?

a. File b. PrintWriter c. Scanner d. System

Computer Science & Information Technology

Method names are always followed by a parameter list, even though the list is sometimes empty.

Answer the following statement true (T) or false (F)

Computer Science & Information Technology

________ speed is the measure of the amount of time required by a storage device to retrieve data and programs.

A. Ethernet B. Bit rate C. Pixel D. Access

Computer Science & Information Technology