import java.io.*;
public class Input1
{
public static void sumChar(byte[] b) //字母统计
{
int n=0;
for (int i=0;i
System.out.println("char count="+n);
}
public static void main(String[] args) throws IOException
{
System.out.println("Input: ");
byte buffer[] = new byte[512]; //输入缓冲区
int count = System.in.read(buffer);
System.out.println("Output: "); //读取标准输入流放入buffer,并返回读取数
for (int i=0;i
System.out.println();
for (int i=0;i
System.out.println("count = "+ count); //buffer实际长度
sumChar(buffer);
}
}
使用charAt()函数,例如 charAt(i)=a; aNumbei++;
楼上正解
这种小东东自己写写
当练习吧