March 2025
Intermediate to advanced
2016 pages
69h 59m
English
1.1 (a), (c), and (d)
Note that the traditional switch construct with case constants is used in this question
Option (b) fails to compile because the switch actions should be enclosed in a block when there is more than one statement in the switch action.
Option (e) fails to compile because it is implemented as a switch expression which must be exhaustive and that is not the case.
Option (f) fails to compile because it attempts to use both the colon (:) and the arrow (->) notations in the same switch block, which is not allowed.
1.2 (a)
Reference x is a static field that references a Dog object. The instanceof pattern match operator returns true. The pattern ...
Read now
Unlock full access