编写一下程序 从键盘上输入一个字符串,统计字符串中英文字母的个数及数字的个数。

日期:2017-12-16 09:46:52 人气:3

编写一下程序 从键盘上输入一个字符串,统计字符串中英文字母的个数及数字的个数。

不用那么复杂,汉字俩字节,英文一个字节,计算下关系就可以了 public class Test { public static void main(String[] args) { Scanner s = new Scanner(System.in, "GBK"); String input = s.nextLine(); byte[] inputBytes = input.getBytes(); System.
    A+
热门评论