How do you read a file using java and eclipse?

can someone explain how to read from a file, line by line and store each line in an ArrayList using java and eclipse, please provide full java code and how to get eclipse to find the file.

53MalePrison2010-06-25T10:55:40Z

Favorite Answer

This is nothing to do with Eclipse.

File myFile = new File(<file location here>);
FileReader fileReader = new FileReader(myFile);
BufferedReader buffReader = new BufferedReader(fileReader);

String str = buffReader.readLine();

Check out various methods available under buffReader.


There are various IO classes available in java. You can use either one. But the basic concept remains the same.

ali_fatolahi2010-06-25T11:22:16Z

See this post for a full code and description

http://once-upon-a-java.blogspot.com/2008/12/file-buffered-readwrite.html

keating2016-10-13T06:46:20Z

besides the shown fact which you contemplated the "res" into "bin" and unique in "src", there is no connection between bin/res folder and src/res folder. throughout the advent of the enter and output variables, you may desire to ensure the source for those records are related properly. desire that facilitates your subject slightly.

Anonymous2014-01-17T02:15:29Z

location mean which location