```
System.out.println(menu);
boolean quit = false;
int selection;
do {
// next user input (of integer type) will be stored in the variable selection
selection = scanner.nextInt();
switch (selection) {
case 1:
System.out.println("Please enter a new record as John Michael West Doe, 574
Pole ave, St. Peter, MO, 63303, 3142752000");
// method to split at each comma
// method to add that input to a Person Object
while (scanner.hasNextLine()) {
String str = scanner.nextLine();
String[] inputs = new String[6];
inputs = str.split(",");
for (int i = 0; i < inputs.length; i++) {
System.out.println(inputs[3]);
}
}
I'm trying to figure out why my inputs array isn't storing the values of the string (input from scanner) split after each comma.
I keep receiving a:
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 3 at PhoneBook.main(PhoneBook.java:52)
I'm trying to do this with just arrays, no array lists.
When I print System.out.println(inputs[i]) - it prints everything split by comma, so I've been messing with my code for days and scouring the web trying to figure out what's going on. Any advice would be much appreciated! I'm going through a coding bootcamp currently and am super excited for things to start clicking slowly. LOL.