January 2014
Intermediate to advanced
736 pages
70h 43m
English
In Fig. B.3, displayMessage’s parameter list (line 7) declares one parameter indicating that the method requires a String to perform its task. When the method is called, the argument value in the call is assigned to the corresponding parameter (courseName) in the method header. Then, the method body uses the value of the courseName parameter. Lines 9–10 of Fig. B.3 display parameter courseName’s value, using the %s format specifier in printf’s format string. The parameter variable’s name (courseName in Fig. B.3, line 7) can be the same or different from the argument variable’s name (nameOfCourse in Fig. B.4, line 24).
The number of arguments in a method call must match the number of parameters in the parameter ...
Read now
Unlock full access