Note that there are some explanatory texts on larger screens.

plurals
  1. POWhat's Wrong With My Load Data Method?
    primarykey
    data
    text
    <p>This is a method I'm using to load saved game data from a file. I'm getting something called error15 at some point because of this. The only thing that came up on Google was something to do with http, but that can't be it because I'm not doing anything like that. When the object prints the strings to the console, it completes the first line of saved data but doesn't go on to read the others. I have a hunch it might have to do with my use of <code>in.nextLine();</code> (is there something else I should be using instead?) If anyone can tell me what I'm doing wrong I will love you forever.</p> <pre><code>/** * Returns a 2-dimensional 15*15 array of saved world data from a file named by x and y coordinates */ public String[][] readChunkTerrain(int x, int y) { String[][] data = new String[15][15]; //the array we will use to store the variables try { //initiate the scanner that will give us information about the file File chunk = new File( "World/" + x + "." + y + ".txt" ); Scanner in = new Scanner( new BufferedReader( new FileReader(chunk))); //go through the text file and save the strings for later for (int i=0; i&lt;15; i++){ for (int j=0; j&lt;=15; j++){ String next = in.next(); data[i][j] = next; System.out.println(i + j + next); //temporary so I can see the output in console System.out.println(); } in.nextLine(); } in.close(); //close the scanner } //standard exception junk catch (Exception e) {System.err.println("Error" + e.getMessage());} return data; //send the array back to whoever requested it } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload