Scanner doesn’t see after space

Change to String name = scanner.nextLine(); instead of String name = scanner.next();

See more on documentation here – next() and nextLine()

Leave a Comment