How do you read in data from a text file that contains nothing but char
s into a 2d array using only java.io.File
, Scanner
, and file not found exception?
Here is the method that I'm trying to make that will read in the file to the 2D array.
public AsciiArt(String filename, int nrRow, int nrCol){
this.nrRow = nrRow;
this.nrCol = nrCol;
image = new char [nrRow][nrCol];
try{
input = new Scanner(filename);
while(input.hasNext()){
}
}
}