Advertisements
Advertisements
Question
Write the syntax for else-if statement.
Answer in Brief
Advertisements
Solution
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
Is there an error in this question or solution?
APPEARS IN
RELATED QUESTIONS
Which of the following is not a branching statement?
In which loop the condition is evaluated, before executing a statement?
<script type=“text/javascript”>
x = 6 + “3”;
document.write(x);
</script>
what will be the output?
What is meant by conditional statements 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?
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);
}Which of the following data type cannot be used with switch case construct?
