CS 121 Lecture Notes - Lecture 22: Semicolon
Document Summary
Method control flow: if the called method is in the same class, only the method name is needed: the called method is often part of another class or object. Method header: begins w/ a method declaration. *parameter list specifies the type & name of each parameter: the by-default visibility modifier makes the method available to all classes in the same package. *the return expression must be consistent w/ the return type. return result; A: it"s sent back to the calling location. A: a method that does not return a value has a void return type. A method w/ a return type can only have one return statement & it must be the last statement in the method. Parameter passing: when a method is called, the actual parameters (2, 1, hello) in the invocation are copied into the formal parameters in the method header.