Chapter 5. Methods
The Structure of a Method
Essentially, a method is a block of code with a name. You can execute the code by using the method's name. You can pass data into a method and receive data as output.
As you saw in the previous chapter, a method is a function member of a class. Methods have two major sections, as shown in Figure 5-1—the method header and the method body.
The method header specifies the method's characteristics, including the following:
Whether the method returns data, and if so, what type
The name of the method
What types of input can be passed to the method
The method body contains the sequence of executable code statements. Execution starts at the first statement in the method body and continues sequentially through the ...