-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCheckPermissions.java
More file actions
43 lines (38 loc) · 952 Bytes
/
CheckPermissions.java
File metadata and controls
43 lines (38 loc) · 952 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
38
39
40
41
42
43
package part;
public class CheckPermissions {
public static void main(String[] args) {
//check if the user has appropriate permissions
final int USER_LEVEL = 2;
check(USER_LEVEL);
}
public static void check(int level) {
switch(level) {
case 1:
System.out.println("You have permission to ban users.");
break;
case 2:
System.out.println("You have permission to restart the server.");
break;
case 3:
System.out.println("You have permission to add new moderators.");
break;
default:
System.out.println("You are an ordinary user.");
break;
}
}
public static void practice() {
char value = 'a';
switch(value) {
case 'A': case 'a':
System.out.println("You are the first letter in the alphabet.");
break;
case 'B': case 'b':
System.out.println("You are the second letter in the alphabet.");
break;
default:
System.out.println("You are an irrelevant value.");
break;
}
}
}