-1

been having some trouble finding the right way to do this. I have a GUI with text fields, check boxes, and combo boxes. I've managed to write these fields to a .dat file but I'm having trouble reading that file. Basically what I need done is to read one line and store it to a string. Then read the next line and store that to another string until I reach the end of the group. I'm not a complete beginner at Java, but I am self taught so a complete code example would very helpfully and really appreciated.

BenMorel
  • 34,448
  • 50
  • 182
  • 322
  • possible duplicate of [read lines in txt file \[java\]](http://stackoverflow.com/questions/4315227/read-lines-in-txt-file-java) – Sergey Kalinichenko Nov 21 '13 at 17:45
  • 1
    `Files.readLines(File, Charset)`, see http://docs.guava-libraries.googlecode.com/git/javadoc/com/google/common/io/Files.html#readLines(java.io.File, java.nio.charset.Charset) –  Nov 21 '13 at 17:48

1 Answers1

1
BufferedReader br = new BufferedReader(
                    new InputStreamReader(
                    new FileInputStream(
                    new File("C:/lol.txt"))));

Then use

br.readLine();
Michael
  • 423
  • 2
  • 8