--------------------Configuration: j2sdk1.5.0 <Default>--------------------
D:\JCreator Pro\MyProjects\ButtonDemo\ButtonDemo\ButtonDemo\test.java:8: cannot find symbol
symbol : method ReadLine()
location: class java.io.File
System.out.println(Ran.ReadLine());
^
D:\JCreator Pro\MyProjects\ButtonDemo\ButtonDemo\ButtonDemo\test.java:8: internal error; cannot instantiate println(boolean) at java.io.PrintStream to (java.io.File.ReadLine)
System.out.println(Ran.ReadLine());
^
2 errorsProcess completed.
D:\JCreator Pro\MyProjects\ButtonDemo\ButtonDemo\ButtonDemo\test.java:8: cannot find symbol
symbol : method ReadLine()
location: class java.io.File
System.out.println(Ran.ReadLine());
^
D:\JCreator Pro\MyProjects\ButtonDemo\ButtonDemo\ButtonDemo\test.java:8: internal error; cannot instantiate println(boolean) at java.io.PrintStream to (java.io.File.ReadLine)
System.out.println(Ran.ReadLine());
^
2 errorsProcess completed.
import java.io.*;public class FileReadTest {
public static void main (String[] args) {
FileReadTest t = new FileReadTest();
t.readMyFile();
}void readMyFile() {
String record = null;
int recCount = 0;
try {
File readfile = new File("F:\\个人资料\\address.txt");
FileReader fr = new FileReader(readfile);
BufferedReader br = new BufferedReader(fr);
record = new String();
while ((record = br.readLine()) != null) {
recCount++;
System.out.println(recCount + ": " + record);
}
br.close();
fr.close();
} catch (IOException e) {
System.out.println("Uh oh, got an IOException error!");
e.printStackTrace();
}
}}
你可以在控制面板中去调节
also buffer is advised.
public class test{
RandomAccessFile Ran;
public test()throws IOException{
Ran=new RandomAccessFile ("abc.txt"."r");
System.out.println(Ran.ReadLine());
}
public static void main(String args[]){
try{
new test();
}
catch(IOException e){
}
}
}
不好意思 我程序发错了 大家在看一下