When I try to create the custom band array, I cannot input a value for position zero. This is what is printed:
"Enter the band name for the 0 position of the array: Enter the band name for the 1 position of the array:"
But, the rest of the input messages appear correctly and I can input a sentence. I tried using entry.next(); but I cannot have a value with space in it (such as Pink Floyd, it is read as 2 values). The rest of the loop appears correctly as:
Enter the band name for the 2 position of the array:
Enter the band name for the 3 position of the array:
etc..
What can I do to fix this? Thank you in advance!
Scanner entry = new Scanner (System.in);
System.out.print("Enter number of bands: ");
int slots = entry.nextInt();
String[] bands = new String[slots];
int x = 0;
String ii;
int i ,y = 1, pos;
String temp = "0";
boolean dupl = false;
System.out.println();
This is the part with the faulty code.
while (x < slots) {
System.out.print("Enter the band name for the " + x + " position of the array: ");
ii = entry.nextLine();
bands[x] = ii;
x++;
}