Package matrice;
import java.util.Scanner;
public class Matrice {
//public void creazione(int mat[][],in)
public static void main(String[] args) {
int mat[][];//matrice
int r,c;//righi e colonne
int i,j;//contatori
r=4;
c=3;
Scanner in= new Scanner(System.in);
mat= new int[r][c];
for(i=0;i<r;i++){
for(j=0;j<c;j++){
mat[r][c]=in.nextInt();
}
}
for(i=0;i<r;i++){
for(j=0;j<c;j++){
System.out.print(mat[r][c]+" ");
}
System.out.println("\n");
}
}
}
errore:
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 4
at matrice.Matrice.main(Matrice.java:21)
Java Result: 1
si legge?mi potete dite dove sbaglio