Core Java 4: Access Modifiers & Dependencies Flashcards

(10 cards)

1
Q

Access Modifiers

A

4: public, default, protected, private

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

public

A

can be modified by all (class, package, subclass, and world).

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

default

A

can be modified within the same class or package only.

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

protected

A

can be modified within the same class, package, or subclass.

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

private

A

can only be modified within class.

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

Dependency

A

objects which class relies on in some way

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

Simple dependency

A

“uses a” relationship: object of another class used as argument/return type of method

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

Association

A

“has a” relationship: one class has object of another class as attribute

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

Aggregation

A

“has many” relationship: one class has many instances of another class

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

Composition

A

“needs a/needs many” relationship: one class has nested class. cannot make instances of nested class without making instance of outer.

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