你scaner设置输入的是int类型,你输入字符肯定会错的; String str=scanner.next(); if(str.matches("[A-Z]")){ System.out.println("大写"); }else if(str.matches("[a-z]")){ System.out.println("小写"); }else{ System.out.println("输入非字母"); } 这样就行了
51,394
社区成员
85,825
社区内容
加载中
试试用AI创作助手写篇文章吧