java FileInputStream cannot find file -
I'm very new in Java coding and I'm having a lot of difficulty I consider using a programmable buffer reader I am, which I have already created with a name called "scores.txt". So I have a method named procedure file that seems to set up a buffted reader and loop through the file, then reading each score again, I have to convert the score to an integer, add them and show the meaning of the calculation.
I do not know how to add them and calculate the meaning, but I am currently working, reading from the file keeps saying it can not recover the file, but I'm sure I have a file in the document called "scores.txt".
It has so far to me ... this is very bad. I am not so good on this :( Maybe there is a different problem?
Public static zero main throws IOException (String [] Arguments, FileNotFoundException {String file = "scores.txt"; Process file ("scores.txt"); // call method process file} throws public static zero process file (string file) IOException, FileNotFoundException {string line; // lines are declared as strings BufferedReader inputReader = new BufferedReader (New InputStreamReader New File InStream L)); while ((line = input reader. Readline ()) = tap) {System.out.println (line);} Inputer.Close ();} < p> Two main options are available
-
Use the full path for the file Drive letter in Windows Or slash in * .nix). It's just very convenient for "testing" tasks.
Sample Windows - D: /someFolder/scores.txt, * .nix - /someFolder/scores.txt
-
Put the file to project the root directory, in such case it will be visible to the square loader.
Comments
Post a Comment