代碼如下:
public static void main(String[] args) {
String str = "AaFsECvcS12483fs+-*/";
int big=0;
int small=0;
int number=0;
for (int i = 0;i<str.length();i++) {
//提取每一個字符的值
char c = str.charAt(i);
//每一個進行判斷比較
if(c>='a'&&c<='z') {
small++;
}else if(c >= 'A' && c <= 'Z') {
big++;
}else {
number++;
}
}
System.out.println("字符串大寫字母有"+big+"個,小寫字母有"+small+"個,數字字符有"+number+"個");
}