Computer Applications
Which of the following is not true with regards to a switch statement?
- 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
Java Conditional Stmts
ICSE Sp 2025
24 Likes
Answer
supports floating point constants
Reason — The switch statement does not support float or double constants as case labels. It supports byte, short, int, char, String and enum.
Answered By
10 Likes
Related Questions
The output of the following code is:
System.out.println(Math.ceil(6.4) + Math.floor(-1-2));- 3.0
- 4
- 3
- 4.0
Which of the following returns a String?
- length()
- charAt(int)
- replace(char, char)
- indexOf(String)
Consider the array given below:
char ch[] = {'A','E','I','O', 'U'};Write the output of the following statements:
System.out.println(ch[0]*2);:- 65
- 130
- 'A'
- 0
To execute a loop 10 times, which of the following is correct?
- for (int i=11;i<=30;i+=2)
- for (int i=11;i<=30;i+=3)
- for (int i=11;i<20;i++)
- for (int i=11;i<=21;i++)