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
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
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
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
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)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
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
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is a static modifier?

A
  • Allows a method to be used without instantiating an object
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
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
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is a fully qualified identifier?

A

Complete name includes the class
E.g. Companyinfo.DisplayHours()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
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
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What are arguments?

A

Data items you use in a call to method

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What are parameters?

A
  • Data items recieved by the method
  • any argument will be promoted to the data type
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
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
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What is a local variable?

A

Variable known only within the boundries of a method

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
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
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What are unreachable statements?

A
  • Statements placed after a methods reutnr statement
  • Can’t execute
  • Dead code
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What does it mean to overload a method?

A

Writing multiple methods in the same scope that have the same name but with different parameter lists

17
Q

What is an ambiguous statement?

A
  • One where the compiler cannot determine which method to use
  • Caused by overloading