#3 cmsc131 review Flashcards

1
Q

overloading

A

same name, different signatures in the same class.
Same name, different parameter lists
(determined during compile time)

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

scope

A

the region of a program where an identifier can be referred to by name
declaration to }

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

characteristics of a static method

A

no current obj, can be invoked by class name(b/c doesn’t need to be invoked by an object), can be used if there are no objects in the class

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

characteristics of a static field

A

one copy for the entire class, shared among all objects of the class, can be used in static or non-static methods (NONSTATIC FIELDS CAN ONLY BE USED IN NONSTATIC METHODS!!!!!)

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

4 types of visibility methods

A
public
protected
package
private
(most to least visible)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

public vs. private methods

A

public: functional to users of any class
private: functional to other methods in the same class

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

protect privacy

A

instead of getters, add methods to a class itself that return info about fields (avoid exposing the actual field outside of the class)

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

when are reference copies safe?

A

when the object is immutable

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