Past few days Getting ArrayIndexOutOfBoundsException .I know this type of questions already asked on #SO . I tried .
java.lang.ArrayIndexOutOfBoundsException: length=1; index=1
Code
String[] Child_DOB = "KUSHAGRA (SON)-07/05/94AANVI (DAUGHTER)-12/06/00 VARENYA (SON) - 26/12/05";
ArrayList<String> children_List = new ArrayList<String>();
ArrayList<Integer> Length_List = new ArrayList<Integer>();
String Children_Details_str = "";
int i = 0;
while (i < Child_DOB.length) {
String name_dob = Child_DOB[i] + " " + Child_DOB[i + 1];//this line
if (i > 3)
Children_Details_str = Children_Details_str + "\n" + name_dob;
else
Children_Details_str = Children_Details_str + name_dob + " ";
children_List.add(name_dob);
Length_List.add(Child_DOB[i].length());
Length_List.add(Child_DOB[i + 1].length());
i = i + 2;
}
May I know what is the correct way to achieve my objective? Any help would be greatly appreciated