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
Advertisements
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.
APPEARS IN
RELATED QUESTIONS
Which conditional statement is used to transfer control from current statement to another statement?
_______ statement can be used as alterative to if-else statement.
Which statement in switch case is used to exit the statement once the appropriate choice is found?
Which of the following is not a branching statement?
The _______ statement is especially useful when testing all the possible results of an expression.
What are the different types of control statement used in JavaScript?
Write the general syntax for switch statement.
What message will be displayed, if the input for age is given as 20, for the following snippet?
Rewrite the following code using the if-else statement:
int m = 400;
double cl). = (m>300) ? (m/10.0) * 2; (m/20.0) - 2;Give the output of the following program segment:
int n = 4279; int d;
while(n>0)
(d=n%10;
System.out.println(d);
n=n/100;
}