Java OCA OCP Practice Question 315

Question

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

  • A. String
  • B. double
  • C. int
  • D. char


B.

Note

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.




PreviousNext

Related