-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathIfElseIfStatement.java
More file actions
37 lines (32 loc) · 935 Bytes
/
Copy pathIfElseIfStatement.java
File metadata and controls
37 lines (32 loc) · 935 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package Phase1_CoreLanguage.DecisionMaking;
/**
* Here, a user can decide among multiple options.The if statements are executed from the top down.
* As soon as one of the conditions controlling the if is true, the statement associated with that if is executed, and the rest of the ladder is bypassed.
* If none of the conditions is true, then the final else statement will be executed.
* <p>
*
* Syntax:
* if (condition)
* statement;
* else if (condition)
* statement;
* .
* .
* else
* statement;**/
public class IfElseIfStatement {
public static void main(String args[])
{
int i = 20;
if (i == 10)
System.out.println("i is 10");
else if (i == 15)
System.out.println("i is 15");
else if (i == 20)
System.out.println("i is 20");
else
System.out.println("i is not present");
}
//OUTPUT
//i is 20
}