English

Which of the following is not true with regards to a switch statement? - Computer Applications

Advertisements
Advertisements

Question

Which of the following is not true with regards to a switch statement?

Options

  • Checks for an equality between the input and the case labels

  • Supports floating point constants

  • Break is used to exit from the switch block

  • Case labels are unique

MCQ

Solution

Supports floating point constants

Explanation:

  • The switch statement in Java does not support floating point constants (float or double) as case labels.
  • It only supports char, byte, short, int, their corresponding wrapper classes, and String and enum types.
shaalaa.com
Introduction of Conditional Statements in Java
  Is there an error in this question or solution?
2024-2025 (April) Specimen Paper
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×