Use LEFT and RIGHT arrow keys to navigate between flashcards;
Use UP and DOWN arrow keys to flip the card;
H to show hint;
A reads text to speech;
15 Cards in this Set
- Front
- Back
Methods |
can be used to define reusable code and organize and simplify coding |
|
Defining a method |
a method definition consists of its method name, parameters, return value type, and body |
|
syntax for defining a method |
modifier returnValueType methodName(lis of parameters) { // method body; } |
|
method header |
specifies the modifiers, return value type, method name, and parameters |
|
returnValueType |
the data type of the value the method returns |
|
void method |
when methods perform desired operations without returning a value the returnValueType is the keyword void also called a value-returning method |
|
Parameter |
variable defined in a method header like a placeholder when a method is invoked, you pass a value to the parameter value is referred to as an actual parameter or argument |
|
Return |
in order for a value-returning method to return a result, a return statement using the keyword return is required the method terminates when a return statement is executed |
|
Calling a method |
executes the code in the method |
|
Activation record |
each time a method is invoked, the system creates an activation record that stores parameters and variables for the method and places the activation record in an area of memory known as a call stack |
|
Call stack |
execution stack, runtime stack, or machine stack when a method finishes its work and returns to its caller, its activation record is removed from the call stack stores the activation records in last-in first-out fashion |
|
Pass-by-value |
when you invoke a method with an argument, the value of the argument is passed to the parameter if the argument is a variable rather than a literal value, the value of the variable is passed to the parameter |
|
scope |
the scope of a variable is the part of the program where the variable can be referenced starts from its declaration and continues to the end of the block that contains the variable |
|
Local variable |
a variable defined inside a method must be declared and initialized before it is used |
|
overloaded method |
two methods can have the same name, as long as their method parameter lists differ |