问题 问答题

阅读下列程序,请写出该程序的功能。
import java. io.*;
public class Class35

public static void main(String[] args)

try

RandomAccessFile file=null;
file=newRandom AccessFile("Class35.java","r");
long fileCurPos=0;
long fileLength=file.length();
while(fileCurPos<fileLength)

String s=file. readLine();
System. out. println(s);
fileCurPos=file. getFilePointer();

file. close();

catch(FileNotFoundException e1)

System.out.println("文件找不到!"+e1);

catch(IOException e2)

System.out. println("文件读写错!"+e2);


答案

参考答案:该程序的功能是:应用程序逐行读取自身的源代码并显示。

问答题
单项选择题