Read a Text File

From Progzoo
Revision as of 16:10, 9 January 2012 by Andr3w (Talk | contribs)

Jump to: navigation, search
You can open a text file and read each line.
  • The BufferedReader represents a text file.
  • You can create BufferedReader from an

FileReader.

  • The while condition (s=fh.readLine())!=null does two

things, it assigns the string s and it checks for null.

The text file [haggis.txt] includes some lines of text.

[Font] [Default] [Show] [Resize] [History] [Profile]