While splitting the String using ',' I am getting Array out of bound exception. Please find below the program.
public static void main(String[] args) {
String c="1,10k ABC D, XYZ AB,,,,,,12345,,,,,,,,,,,,,,,,,,,,,,,,,,,,,";
System.out.println(c.split(",")[11]);
}
Even the 11th element is null i want to print the null string (Because in some records the 11th element is not null). Kindly help me to debug the error.
c.split(",")returns:[1, 10k ABC D, XYZ AB, , , , , , 12345]