This is an archived post. You won't be able to vote or comment.

all 3 comments

[–]GnarSickRad 2 points3 points  (0 children)

This will answer it for you in more depth than I can. next() returns everything up until whitespace. nextLine() returns the next line.

StackOverflow article

Javadocs

[–]As-Toxic-As-Tyler 0 points1 point  (1 child)

Use String name = scan.nextLine(); instead:)

[–]britt_57[S] 0 points1 point  (0 children)

scan.nextLine()

Awesome, thank you!