Declarations and Access Control Self Test Flashcards

1
Q

Can variables names begin with #

A

No

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

Can variable names begin with a currency sign ($ £ €)

A

Yes

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

If variable in public class in other package is declared protected, how can it be accessed?

A

Can only be accessed through inheritance ie through extending class and using variable ref, not through class instantiation ref

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

What are interface methods by default? (Private, default, private, protected)

A

Public

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

What must classes which implement interface methods implement them as?

A

Public

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

Can visibility be reduced for implemented methods from interfaces?

A

No, visibility cannot be reduced.

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

Does an interface extend or implement another interface?

A

Interfaces extend other interfaces

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

Can a non-static method in another class be invoked from a static context?

A

No, it cannot be invoked.

Method must be declared static.

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