Section 6.4 Declaring Methods with Multiple Parameters

• When a method is called, the program makes a copy of the method’s argument values and assigns them to the method’s corresponding parameters. When program control returns to the point in the program where the method was called, the method’s parameters are removed from memory.

• A method can return at most one value, but the returned value could be a reference to an object that contains many values.

• Variables should be declared as fields of a class only if they’re required for use in more than one method of the class or if the program should save their values between calls to the class’s methods.

• When a method has more than one parameter, the parameters are specified as a comma-separated ...

Get Java™ How To Program (Early Objects), Tenth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.