class Property {
public static void main (String[] args) {
Scanner input = new Scanner(System.in);
String[] rooms = new String[15];
System.out.println("How many rooms? ");
int roomLimit = input.nextInt();
for (int i = 0; i < roomLimit; i++) {
System.out.println("Enter room name " + (i + 1));
rooms[i] = input.next();
}
When I enter room names that are single words like, 'double, single, master, etc.', the list of room names displays fine. But when I enter room names with more than one word, only the first word is listed, and the second word of the first room name automatically becomes the second room name as shown below.
How many rooms?
4
Enter room 1
Double Duluxe
Enter room 2
Enter room 3
Couple Golden
Enter room 4
List of Chosen Rooms
Room 1: Double
Room 2: Duluxe
Room 3: Couple
Room 4: Golden
Process finished with exit code 0