Describe how you can use multiple arguments in a method. Provide an example.

What will be an ideal response?


You can pass multiple arguments to a method by listing the arguments within the call to the method and separating them with commas. You can write a method so that it takes any number of parameters in any order. However, when you call a method, the arguments you send to a method must match in order-both in number and in type-the parameters listed in the method declaration. Although the calculated gross pay is the same either way, the call calculateGross(10, 20); results in output describing 10 hours worked at $20 per hour, but calculateGross(20, 10); results in output describing 20 hours worked at $10 per hour.

Computer Science & Information Technology

You might also like to view...

Programs are identified by name in a disk’s __________.

a. IOCS b. directory c. file system d. they aren't

Computer Science & Information Technology

A UPS uses a(n) ________ to power a computer for a limited time

Fill in the blank(s) with correct word

Computer Science & Information Technology

The numbering system in which the only integers are a 0 or a 1, is known as the ________ system.

What will be an ideal response?

Computer Science & Information Technology

In the queue ADT implementation, the node structure is _____ to the structure used for a stack.

A. similar B. very different C. identical D. completely different

Computer Science & Information Technology