-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcheckChar.java
More file actions
30 lines (26 loc) · 845 Bytes
/
Copy pathcheckChar.java
File metadata and controls
30 lines (26 loc) · 845 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
package practice;
import java.util.Scanner;
import static java.lang.System.exit;
public class checkChar {
public static void main(String args[]) {
Scanner input = new Scanner(System.in);
for (;;){
System.out.println("input character '!' for exit");
char character = input.nextLine().charAt(0);
if(character == '!'){
exit(1);
}
else{
if(character >='A' && character <= 'Z'){
System.out.println("Upper case char");
}
else if(character >='a' && character <= 'z'){
System.out.println("Lower case char");
}
else {
System.out.println("Special char");
}
}
}
}
}