Zoo tutorials: [ SQL | Linux | XML ]
ProgZoo: [ Java | C# | VB | C++ | Perl ]
Log in

A Gentle Introduction to
Java Programming

Read a Text File

 

Top Ten Programs

Read a Text File
You can open a text file and read each line.

1. [ Java ] Reading lines


Big

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

  • The BufferedReader represents a text file.
  • You can create BufferedReader from a FileReader.
  • The while condition (s=fh.readLine())!=null does two things, it assigns the string s and it checks for null.