Which of the following variable types is not permitted in a switch statement?

Which of the following variable types is not permitted in a switch statement?

A. String

B. double

C. int

D. char

Answer:

B. double

Explanation:

A switch statement supports the primitive types byte, short, char, and int and the classes String, Character, Byte, Short, and Integer. It also supports enumerated types.

Floating-point types like float and double are not supported, therefore Option B is the correct answer.


Comments