Basics Test 1 Flashcards

1
Q

If classes have default access, how can they be accessed?

A

Only by other classes in the exact same packages

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

Where does scope end for a variable declared and initialised within a for loop?

A

Within that loop, can’t be accessed outside of it

Obvious but easy to overlook

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

Non-nested classes and interfaces can be… (2 options)

A
  • abstract public

- final public

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

Non-nested classes and interfaces cannot be… (3 options)

A
  • static public
  • protected
  • final abstract (doesn’t make sense if thought about)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Within a try-catch statement, what is the scope of variables in the try statement?

A

Only in the try statement, not in the catch

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

Within a try-catch statement, what is the scope of variables in the catch statement?

A

Only in the catch statement, not in the try

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