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
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
3
Q
Non-nested classes and interfaces can be… (2 options)
A
- abstract public
- final public
4
Q
Non-nested classes and interfaces cannot be… (3 options)
A
- static public
- protected
- final abstract (doesn’t make sense if thought about)
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
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