java IO流操作
如题:2021年4月 第30题
public class Test30_2104 {
public static void main(String[] args) throws IOException {
InputStreamReader isr = new InputStreamReader(System.in);
BufferedReader br = new BufferedReader(isr);
String str = br.readLine();
int i, ditNo = 0, upCharNo = 0, IoCharNo = 0, otherCharNo = 0;
for (i = 0 ; i < str.length(); i++) {
if (str.charAt(i) <= '9' && str.charAt(i) >= '0') {
ditNo++;
} else if (str.charAt(i) <= 'Z' && str.charAt(i) >= 'A') {
upCharNo++;
} else if (str.charAt(i) <= 'z' && str.charAt(i) >= 'a') {
IoCharNo++;
} else otherCharNo++;
} System.out.println("N1=" + ditNo + "\t" + "N2=" + upCharNo);
System.out.println("N3=" + IoCharNo + "\t" + otherCharNo);
}
}
分析:要求分析程序的输出结果
不太熟悉!再复习下吧!
基本知识
java的IO包括:对外设通道的输入/输出、对文件的读和写、对网络

本文主要分析2021年4月第30题的Java程序输出,探讨IO流的基本知识和扩展内容。Java IO包括字节流、字符流、文件流、缓冲流、转换流、数据流和对象流。重点讲解了InputStreamReader作为转换流的作用,以及何时使用缓冲输入/输出流。同时,介绍了数据流处理基本数据类型的功能,以及对象流的序列化与反序列化操作。
最低0.47元/天 解锁文章
2396

被折叠的 条评论
为什么被折叠?



