public class Test1 {
public static void main(String[] args) {
Scanner input=new Scanner(System.in);
String a=input.nextLine();
char b=a.charAt(0);
System.out.println("输入字符的ASCII值十进制:"+(int)b);
int c=b;
if(97<=c && c<=122){
System.out.println("小写字母");
}
else if(65<=c && c<=90){
System.out.println("大写字母");
}
else if(48<=c && c<=57){
System.out.println("数字字符");
}
else if(c==43 || c==45 || c==42 || c==47 || c==37){
System.out.println("算术运算符");
}
else if(60<=c && c<=62){
System.out.println("关系运算符");
}
else if(c==38 || c==124 || c==33 || c==94 ){
System.out.println("逻辑运算符");
}else
System.out.println("其他运算符");
input.close();
}
}
java 输入一个字符输出字符的ASCII值并判断是什么类型的字符
最新推荐文章于 2023-04-11 19:45:16 发布