it/215 week3

it/215 week3

Checkpoint: Methods with Multiple Parameters
Thursday March 2015

Checkpoint: Methods with Multiple Parameters


The definition of a “method” as it relates to the java programming language is as follows: It is part of a class that implements some of the behaviors of objects in another class. The body of a method contains declarations of local variables and statements to implement the behavior. A method receives input by way of its arguments, if any exist, and may return a result if it has not been declared as voided.


Parameters are defined as information that is passed to a method. Parameters are also referred from time to time as “Arguments”. Methods that are expected to receive arguments have to contain a formal argument declaration for each one as part of the header for the method. After a method has been called, then the actual values for each argument are copied into the formal arguments that corresponds to each of them.

Here is an example:

1. public String getInfo(String name, String street, String city, String state, String zipcode) {

2. return name + “ “ + Street + “ “ + city+” ”+state+” ”+zipcode;

3. }

In regards to core elements of a method with numerous parameters, it is the defining of each parameter properly before building methods that utilize the information in the parameters in such a way that is functional and important for each application at hand.

In the example that was given above the request for name, street, etc. is basic information for say the shipping of packages and such. This could also be seen as a String method entitled “getinfo”, with the parameters of name, street, city, state, and zipcode. At this point, the information could very well be returned as information to the destination of ones choosing.


JavaTM: How to Program, Ninth Edition, by Paul Deitel and Harvey Deitel. Published by Prentice Hall. Copyright © 2012 by...

Similar Essays