Advertisements
Advertisements
Question
_______ statement can be used as alterative to if-else statement.
Options
While
If
Else-if
Switch
MCQ
Fill in the Blanks
Advertisements
Solution
Switch statement can be used as alterative to if-else statement.
shaalaa.com
Introduction of Conditional Statements in Java
Is there an error in this question or solution?
APPEARS IN
RELATED QUESTIONS
Which statement in switch case is used to exit the statement once the appropriate choice is found?
<script type=“text/javascript”>
x = 6 + “3”;
document.write(x);
</script>
what will be the output?
List out the various branching statements in JavaScript?
Differentiate the break and continue statement.
Write the syntax for else-if statement.
Explain switch case statement with example.
The absence of which statement leads to fall through situation in switch case statement?
Consider the following program segment and select the output of the same when n = 10:
switch(n)
{Case 10: System.out.println(0*2);
case 4: System.out.println(n*4); break;
default : Syslem.out.println(n);
}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;
}Rewrite the following code using single if statement.
if(code=='g')
System.out.println("GREEN");
else if(code=='G')
System.out.println("GREEN");