Skip to content

Tag: filereader

How to save information separately form .txt into multiple strings in Java

I have a mydata.txt, where I want to read in information separately. The 1st row save as “zoo number”, “animal number” the 2nd row till the 5th row save as “data for animals in matrix” the 6th row save as dog “number” “appetite” “weight” “height” The code I written as below, however, my code only be able to reload everything

Read files from directory using BufferedReader

I wrote a code to read a files from a directory. The directory contain many files. Firstly, I count the number of the files in the directory, then I would like to count number of lines in the files that have as extension: .info and .data My code is the following: I got as error: The error concerns the FileReader,