62,620
社区成员
发帖
与我相关
我的任务
分享
import java.io.File;
import java.io.RandomAccessFile;
public class Test8 {
public static void main(String[] args) throws Exception {
RandomAccessFile r = new RandomAccessFile(new File("c:\\Test.txt"),
"rw");
for (int i = 1;; i++) {
String temp = r.readLine();
if (temp == null)
break;
System.out.println(i + ":" + temp);
}
}
}
String[] str = {"123"};
System.out.println(str);[Ljava.lang.String;@de6cedpublic static void main(String[] args) throws Exception {
FileInputStream fis = new FileInputStream("c:\\Test.txt");
InputStreamReader isr = new InputStreamReader(fis);
BufferedReader br = new BufferedReader(isr);
for (int i = 1;; i++) {
String temp = br.readLine();
if (temp == null)
break;
System.out.println(i + ":" + temp);
}
}