package com.test;
import com.sun.xml.internal.org.jvnet.fastinfoset.sax.FastInfosetReader;
import java.util.Scanner;
public class ScannerDemo {
public static void main(String[] args) {
int daxie = 0;
int xiaoxie = 0;
int num = 0;
//录入字符串
Scanner sc = new Scanner(System.in);
System.out.println("请录入一个字符串:");
String s = sc.nextLine();
//遍历字符串,获取索引所在字符
for(int i=0; i<s.length(); i++){
char a = s.charAt(i);
if (a>='a' && a <='z'){ //程序默认使用其中的 ASCII 值进行比较
xiaoxie++;
}else if(a>='A' && a<='Z'){
daxie++;
}else if(a>='0' && a<='9'){
num++;
}
}
System.out.println("大写字符个数为:"+daxie);
System.out.println("小写字符个数为:"+xiaoxie);
System.out.println("数字个数为:"+num);
}
}