1. Learn
  2. /
  3. Courses
  4. /
  5. Importing Data in Java

Connected

Exercise

Reading files with BufferedReader

As your work continues, the company has started receiving larger market data files. Your manager has suggested using Java I/O streams for better efficiency. As a first step, you need to implement a solution that reads the first few lines of a CSV file using a character stream.

The BufferedReader and FileReader classes have been imported for you.

Instructions

100 XP
  • Create a reader using chained constructors passing filePath to the FileReader.
  • Read and print the header line.
  • Read and print the first data row.