This is my first question here. I am trying to write a program that reads as many arrays as I input from the keyboard. After inputting the number of columns I get the error: Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0
Thanks in advance.
package Final;
import java.util.*;
public class Final {
int a,b,x,l;
double mat[][][];
Final()
{
a=0;
b=0;
c=0;
d=0;
x=0;
l=0;
}
public void read() {
Scanner citast = new Scanner(System.in);
System.out.println("How many arrays do you want to enter?");
x=citast.nextInt();
for (this.l=0; this.l<x; this.l++)
{
System.out.println("Matrix "+this.l);
System.out.println("Number of lines: ");
this.a = citast.nextInt();
System.out.println("Number of columns: ");
this.b = citast.nextInt();
this.mat= new double [this.l][a][b];
for (int i=0; i<this.a; i++)
{
for (int j=0; j<this.b; j++)
{
System.out.print("Matrice " + l + " ["+ i +"]["+ j +"]= ");
this.mat[l][i][j]=citast.nextInt();
}
System.out.println();
}
}
}
public static void main(String[] args) {
Final a = new Final();
Scanner citast = new Scanner(System.in);
a.read();
System.out.println();
}
}
Scanner citast = new Scanner(System.in);in main?