Methods and Parameters

Objective #1: Call methods.

Objective #2: Identify the parts of a method.

Objective #3: Call methods that are implemented in the same class file.

Objective #3: Pass parameters to methods.

Notice the use of inline "end of" comments that are useful in keeping track of where one method, loop, or class ends and another one begins. Also notice that blank lines that are placed around loops and methods to make the code more readable. The value 3 in the call statement automatically matches up with the formal parameter num in the drawMan method header while the string literal "Bob" matches up with the formal parameter name.

Objective #4: Return values from methods.

Even though you may not have studied if statements or the random method, the methods above work as their names imply. The data type that is returned by each method is typed after the keyword static and before the name of the method.

Objective #5: Write your own user-defined static methods.

Objective #6: Make use of overloaded methods.

Objective #7: Use local variables within methods.