Question 4
Back to Exercise
Which of these cannot be the controlling expression of a switch?
- A char
- B enum value
- C long
- D double Correct
Correct Answer: Option D
A switch needs an integer type. Floating-point values are not allowed (exact comparison of doubles would be unreliable anyway), and neither are strings.
Discussion & Comments 0
Share your method, a shortcut, or ask about a step you didn't follow.
No comments yet. Be the first to share your solution!