CS 121 Lecture Notes - Lecture 22: Semicolon

23 views3 pages

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.

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers

Related Documents

Related Questions