I have the following code:
Scanner in = new Scanner (System.in);
String[] data = new String[5];
System.out.println(\"Please, enter the name of the customer orde
This should work:
Scanner in = new Scanner (System.in);
String[] data = new String[5];
System.out.println("Please, enter the name of the customer ordering:");
data[0] = in.nextLine();
System.out.println("Please, enter the assembly details: ");
data[1] = in.nextLine();
System.out.println("Please, enter the assembly id:");
data[2] = in.nextLine();
System.out.println("Please, enter the date the assembly was ordered (MM-DD-YYYY):");
data[3] = in.nextLine();
in.close();
You should be using nextLine()
and not next()
to read each line from console