ArrayIndexOutofBounds -- help?
<p>The problem is at <code>int [][]tam = new int [a][b]</code>. It's only that line. I am new to Java and coming from a C++ background.</p>

<pre><code>//"Exercitiul" 3
Scanner input = new Scanner(System.in);//instructiune scanner
DataInputStream dis4 = new DataInputStream(System.in);
DataInputStream dis5 = new DataInputStream(System.in);
String st1 = null;
String st2 = null;
try{
  System.out.println("Introduceti numarul de Randuri"); 
  st1 = dis4.readLine();
  System.out.println("Introduceti numarul de Coloane"); 
  st2 = dis5.readLine();
}

catch (IOException ioe) {
ioe.printStackTrace();
}

int a = Integer.parseInt(st1);
int b = Integer.parseInt(st2);

int [][]tam = new int[a][b];

System.out.println("Verificare " + tam[a][b]);
System.out.println("Introduceti Elementele Matricei ");

for (int m=0 ; m &lt; tam.length ; m++)
for  (int n=0 ; n &lt; tam[i].length ; n++){

tam[m][n] = input.nextInt();//instructiune scanner
}

System.out.println("Matricea A: ");
for (int m=0 ; m &lt; tam.length ; m++)
{     System.out.println();
    for  (int n=0 ; n &lt; tam[i].length ; n++)
        System.out.print(tam[m][n]+" ");
          }

Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 3
at Program.main(Program.java:95)
</code></pre>
