Computer Applications

Which of the following data type cannot be used with switch case construct?

  1. int
  2. char
  3. String
  4. double

Java Conditional Stmts

ICSE 2024

7 Likes

Answer

double

Reason — The switch statement in Java supports specific data types for the case labels. However, double and float data types cannot be used.

Data Types supported in switch statement are:

  1. int
  2. char
  3. String

Answered By

4 Likes


Related Questions