ok, so i have an int[][] that i need to be printed out into a file. it needs to be printed line by line with each number seperated by a comma.
how does this look? im not getting any output...
import java.io.*;
import java.util.*;
public class TestingII {
public static void main(String[] args){
int[][] data = {{1,2,3,4},
{5,6,7,8},
{4,9,1,0},
{2,5,8,3}};
Scanner stdIn = new Scanner(System.in);
PrintWriter writer;
try
{
System.out.print("Enter a filename: ");
writer = new PrintWriter(stdIn.nextLine());
for (int i = 0; i<data.length; i++){
for(int j = 0; j<data.length; j++){
writer.print(data[i][j] + ",");
}writer.println();
}
}
catch (FileNotFoundException e){
System.out.println("Error: " + e.getMessage());
}
}
}