-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathControlFlow.java
More file actions
55 lines (40 loc) · 1.3 KB
/
ControlFlow.java
File metadata and controls
55 lines (40 loc) · 1.3 KB
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
package com.tyss.corejava;
public class ControlFlow {
//if variable is a decision making statement
public static void main(String[] args) {
//if variable is a decision making statement
System.out.println("if\n---------------------------------");
System.out.println("program starts");
if(true) {
System.out.println("welcome");
}
int x=20;
int y=30;
if(x>y) {
System.out.println("yep!!");
}
System.out.println("program ends happily\n__________________________________");
//ifelse statement
System.out.println("ifelse\n---------------------------------");
int money=2000;
if(money>10000) {
System.out.println("lets enjoy ur lilfe");
}
else {
System.out.println("better luck next time!!!\n________________________________________");
}
//elseif ladder statement
System.out.println("if else if \n-------------------------------");
int money1=18000;
if(money1>10000 && money1<11000) {
System.out.println("lets enjoy ur life in your own city");
}else if(money1>11000 && money1<12000) {
System.out.println("lets enjoy ur life in shimla");
}else if(money1>12000) {
System.out.println("lets enjoy ur life in Dazling");
}
else {
System.out.println("better luck next time!!!\n________________________________________");
}
}
}