Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and beginning April 20th, 2021 (Eastern Time) the Yahoo Answers website will be in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.

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.

4 Answers

Relevance
  • 1 decade ago
    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.

  • 1 decade ago

    See this post for a full code and description

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

  • 5 years ago

    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.

  • Anonymous
    7 years ago

    location mean which location

Still have questions? Get your answers by asking now.