I want to write a matrix to a file in java by using jama library.However, only a empty file is produced. I am using the code below. What can be wrong?
PrintWriter writer = null;
try {
writer = new PrintWriter("deneme.txt", "UTF-8");
} catch (FileNotFoundException | UnsupportedEncodingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
m3.print( writer,2,2);
writer
could be null when it comes to this line of code. Move them3.print(writer,2,2);
inside of the try block.