I can't seem to remember how to read in a .txt file into a java program. Help?
posted 14 years ago
Not sure what you mean by reading a file into a java program. If you just want your java program to read a text file... wrap a buffered reader around a file reader, and then use it's reaadline method to read one line at a time. FileReader fr = new FileReader("Youfilename") BufferedReader br = new Bufferedreader(fr) String line = be.readLine() while(line != null) do whatever... //read the next lien line = be.readLine()
------------------ Bosun SCJP for the Java� 2 Platform
Bosun (SCJP, SCWCD)
So much trouble in the world -- Bob Marley