-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathCharCheck.java
More file actions
25 lines (23 loc) · 873 Bytes
/
CharCheck.java
File metadata and controls
25 lines (23 loc) · 873 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
import java.util.Scanner;
public class CharCheck {
public static void main(String[] args)
{
Scanner scanner = new Scanner(System.in);
System.out.print("Enter a character : ");
String input = scanner.next(); //String is not primitive data type
char ch = input.charAt(0);
if(Character.isLowerCase(ch))
{
System.out.println(ch + " is lowercase letter.");
System.out.println(" => to uppercase letter :"+ Character.toUpperCase(ch));
}
else if (Character.isUpperCase(ch))
{
System.out.println(ch + " is a upperchase letter");
System.out.println(" => to lowercase letter : "+ Character.toLowerCase(ch));
}else if(Character.isDigit(ch))
{
System.out.println(ch + " is a digit number ");
}
}
}