@求字符串中大小写数字的个数
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.println("请输入一个字符串");
String s = sc.nextLine();
int bigcount = 0;
int smallcount = 0;
int numbercount = 0;
for (int i = 0; i < s.length(); i++) {
char ch = s.charAt(i);
if(ch>='A'&&ch<='Z'){
bigcount++;
//System.out.println("大写字母有:"+bigcount);
}else if(ch>='a'&&ch<='z'){
smallcount++;
//System.out.println("小写 字母有:"+smallcount);
}else if(ch>='0'&&ch<='9'){
numbercount++;
//System.out.println("数字出现的个数:"+numbercount);
}else{
System.out.println("字符"+ch+"非法");
}
}
System.out.println("大写字母有:"+bigcount+"小写 字母有:"+smallcount+"数字出现的个数:"+numbercount);
}