Chapter 6 Flashcards

1
Q

What 3 key properties does an instance variable have?

A

1) Each object has its own set of instance variables
2) The scope extends throughout the entire class
3) The lifetime of an instance variable is the same as the lifetime of the object to which it belongs

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

The 4 key parts to an instance variable declaration/

A

1) An access modifier
2) A type
3) A descriptive name
4) An initial value

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

What does an accessor method answer?

A

What value does attribute X currently hold?

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

What 3 ways are instance variables different than temporary and parameter variables?

A

1) They are declared in a class but out of all methods
2) They have a larger scope - the entire class
3) They have a longer lifetime - same as the object that contains them

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

Define a constant variable

A

A special type of instance variables that doesn’t change and is written in all caps

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

If both variable types are int, java performs ______ division

A

Integer

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

What does overloading a method mean?

A

They have the same name but different signatures.

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