public static void main(String[] args)throws IOException { File inFile = new File("grid.txt"); Scanner scanner = new Scanner(inFile); String[] size = scanner.nextLine().split("\\s"); char[][] array = new char[10][10]; for(int i=0; i < 10; i++) { array[i] = scanner.nextLine().toCharArray(); } for(int k = 0; k < array.length; k++){ for(int s = 0; s < array[k].length; s++){ System.out.print(array[k][s] + " "); } System.out.println(); } scanner.close(); }
What i am doing wrong ? please help
I get java.util.NoSuchElementException: No line found
File Format :
eoksibaebl
ropeneapop
mbrflaoyrm
gciarrauna
utmorapply
wnarmupnke
ngrelclene
alytueyuei
fgrammarib
tdcebykxka