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包括:对外设通道的输入/输出、对文件的读和写、对网络数据的读和写
四