before anyone tells me, i checked the path, and i tried both with abosolute and relative paths, but the error remains the same. Here is the code.
public class Main {
public static void main (String[] args) {
Scanner input = new Scanner(System.in);
Scanner gimmiethetxtplz = new Scanner(new File("cars.txt"));
int rows = input.nextInt();
int columns = input.nextInt();
String[][] cars = new String[rows][columns];
for (int i = 0; i < rows; i++) {
for (int j = 0; j < columns; j++) {
cars[i][j] = gimmiethetxtplz.nextLine();
System.out.print(cars[i][j] + " ");
}
System.out.println();
}
input.close();
}
}
The file is in the src folder
Exception in thread "main" java.lang.Error: Unresolved compilation
problem:
Unhandled exception type FileNotFoundException
at training.Main.main(Main.java:9)