for (int k = 0; k < dec2.length; k++) {
System.out.println(dec2[k]);
String[] tab = dec2[k].split(",");
System.out.println(tab[0]);
When I try this code, dec2
is a String array containing:
41,31
11,21
42,41
12,22
When I try to display tab[0]
, I get the first number (before the ","), but tab[1]
returns an ArrayIndexOutOfBoundsException
, and I don't get why since it's supposed to contain the 2nd number (after the ",").