Which of the following data type cannot be used with switch case construct?
Advertisements
Question
Which of the following data type cannot be used with switch case construct?
Options
int
char
String
Double
MCQ
Advertisements
Solution
Double
Explanation:
- The data type double is incompatible with all versions of Java.
- There's a doubt. The string data type is also not usable in Java versions prior to 7.0, but it works in switches from 7.0 and above.
shaalaa.com
Introduction of Conditional Statements in Java
Is there an error in this question or solution?
