-
Notifications
You must be signed in to change notification settings - Fork 13
/
IfElse.java
37 lines (29 loc) · 1004 Bytes
/
IfElse.java
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 lessons.flowcontrol.ifelse;
public class IfElse {
public static void main(String[] args)
{
java.util.Scanner keyboard = new java.util.Scanner(System.in);
System.out.print("Yasin age: ");
int yasinAge = keyboard.nextInt(); // 21
System.out.print("Akif age: ");
int akifAge = keyboard.nextInt(); // 29
System.out.print("Eren age: ");
int erenAge = keyboard.nextInt(); //17
// Let's go to the bar
if (yasinAge >= 18)
System.out.println("Yasin can enter the bar");
else
System.out.println("Yasin cant enter the bar");
if (akifAge >= 18) {
System.out.println("Akif can enter the bar");
}
else {
System.out.println("Akif cant enter the bar");
}
if (erenAge >= 18) {
System.out.println("Eren can enter the bar");
} else {
System.out.println("Eren cant enter the bar");
}
}
}