Advertisements
Advertisements
प्रश्न
Write the syntax for else-if statement.
थोडक्यात उत्तर
Advertisements
उत्तर
Syntax:
if (expression1)
{
Execute code block #1
}
else if (expression2)
{
Execute code block #2
}
else if (expression3)
{
Execute code block #3
}
else
{
If all else fails, execute block #4
}shaalaa.com
Introduction of Conditional Statements in Java
या प्रश्नात किंवा उत्तरात काही त्रुटी आहे का?
APPEARS IN
संबंधित प्रश्न
Which conditional statement is used to transfer control from current statement to another statement?
Which statement in switch case is used to exit the statement once the appropriate choice is found?
What will be the output for the following snippet:
For (var n=0; n<10; n++)
{
if (n==3)
{
break;
}
document write (n+”<br>”);
}<script type=“text/javascript”>
x = 6 + “3”;
document.write(x);
</script>
what will be the output?
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?
Explain switch case statement with example.
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);
}Which of the following data type cannot be used with switch case construct?
Which of the following is not true with regards to a switch statement?
