We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
next() and nextLine() do different things. I agree that it is somewhat confusing that next() skips over newlines, while nextLine() doesn't. For now, you should refer to the documentation of each function whenever you use them until you get used to how they behave.
Java Stdin and Stdout II
You are viewing a single comment's thread. Return to all comments →
next() and nextLine() do different things. I agree that it is somewhat confusing that next() skips over newlines, while nextLine() doesn't. For now, you should refer to the documentation of each function whenever you use them until you get used to how they behave.
I also added a detailed explanation of how each function works.
HackerRank solutions.