Pessoal, estou com dúvidas em relação ao código abaixo:
[code]import java.util.*;
public class Ex2 {
/**
* @param args
*/
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
int x, y;
Boolean z = false;
System.out.print(" - informe o numero de linhas da matriz: ");
x = input.nextInt();
System.out.print(" - informe o numero de colunas da matriz: ");
y = input.nextInt();
int mat[][] = new int [x][y];
for(int i = 0; i < x; i++){
for(int c = 0; c < y; c++){
if(mat[i][c] == mat[c][i]){
z=true;
}
}
}
if (z)
System.out.println("a matriz e simetrica ");
else
System.out.println("a matriz nao e simetrica ");
}
}[/code]
[b]É o seguinte.
Para mostrar se a matriz é invalida ocorre um erro![/b]
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 2
at Ex2.main(Ex2.java:23)
[b]Creio que esteja ocorrendo um problema de estouro!
como posso desenvolver melhor o raciocio deste código?
Obrigado. [/b]