代码演示
****public class** MyTest2 **{** **public static void** main**(**String**[]** args**) {** /* 统计键盘录入的字符串中包含大写字母、小写字母、数字的个数,并测试。 */ String str=**"S1f22d5b2S5F55h55C5h5h5455t1S5b5V8g985d5rC5dV"**; **int** num=0; **int** da=0; **int** xiao=0; **for** **(****int** i = 0; i < str.length**()**; i++**) {** **char** ch=str.charAt**(**i**)**; **if** **(**ch>=**'a'**&&ch<=**'z'****){** xiao++; **}****else if** **(**ch>=**'A'**&&ch<=**'Z'****){** da++; **}****else** **{** num++; **}** **}** System.**out**.println**(****"****大写字母有****"**+da+**"****个****"****)**; System.**out**.println**(****"****小写字母有****"** + xiao + **"****个****"****)**; System.**out**.println**(****"****数字字符有****"** + num+ **"****个****"****)**; **}****}**