问答题

以下程序实现的功能是从文件file.txt中读取字符,然后判断每个字符在字母表中的顷序是否位于“A”和“Z”之间,若是,则计数器cnt加1,否则继续读取字符直到文件结束。请将程序补充完整。
注意:不改动程序结构,不得增行或删行。
package ch3;
import java.io*;
public class ex3
public static void main(String[] args)

int cnt=0;
try

______f=new______("ch3/file.txt");
int Ch;
while( )

if( )
______;

System.out.println("count="+cnt);
f.______();

catch(Exception e)

e.printStackTrace();


【参考答案】

FileInputStream
FileInputStream
ch=f.read()!=-1......

(↓↓↓ 点击下方‘点击查看答案’看完整答案、解析 ↓↓↓)
热门 试题