File output in JAVA (not C++ sorry to offend;))
Hey sorry know this is strictly a c/c++ board but you guys seem helpfull so maybe u can help with some java to, I have the following code
Code:
public static void outputFile(double[][] y)
{
// Declare output file
File file = new File("output.txt");
try{
// Declare file output stream
FileWriter fos = new FileWriter(file);
for(int i = 0; i < y.length; i++)
{
char yc = (char)y[i][1];
fos.write(yc);
}
// Close the file
fos.close();
}
catch(IOException ex)
{
System.out.println(ex.getMessage());
}
}
and im getting an array index out of bounds excpetion. Cant figure out why tho as the for loop is for the length of the array and i write one element of the array each loop iteration (or so i believe), any ideas?