Chapter 3 Flashcards
1
Q
What is a method header?
A
- Contains information about how other methods can interact with it
- also called method decloration
2
Q
What is a method?
A
- Program module that contains a series of statements that carry out a task
- To execute a method, you call/invoke it from another method
- Calling method invokes a called message
3
Q
What does a method header contain?
A
- Optional access specifiers
- Optional static modifier
- A return type
- An identifier
- Parentheses (may or may not be empty)
4
Q
What is a method body?
A
- Contains the statements that carry out the work of a method
- called its implementation
- between a pair of curly braces
5
Q
What is a static modifier?
A
- Allows a method to be used without instantiating an object
6
Q
What is a return type?
A
- describes the type of data the method sends back to its calling method
- Void: no data is returned to the method
- Return type is also known as method type
7
Q
What is a fully qualified identifier?
A
Complete name includes the class
E.g. Companyinfo.DisplayHours()
8
Q
What is the method signature?
A
- Combination of the method name and the number, types, and order of arguments
- Method call must match method signature
9
Q
What are arguments?
A
Data items you use in a call to method
10
Q
What are parameters?
A
- Data items recieved by the method
- any argument will be promoted to the data type
11
Q
What is implementation hiding?
A
- Encapsulation of method details within a class
- Calling method needs to understand only the interface to the called method
12
Q
What is the interface of a method?
A
The only part of the method that the client sees or with which it interacts
13
Q
What is a local variable?
A
Variable known only within the boundries of a method
14
Q
When does a method end?
A
- When a method completes all of its statements
- When a method throws an exception
- When a method reaches a return statement
15
Q
What are unreachable statements?
A
- Statements placed after a methods reutnr statement
- Can’t execute
- Dead code