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.
i have a question if u try
s = sc.hansNext(); , it ouptputs the 1st word in the next line's string , shouldn't it also read the enter key ( empty output) instead of jumping to the next like nextLine() did in our case.
next() places the cursor in the same line after reading the input.
nextLine() positions the cursor in the next line ater reading output
Java Stdin and Stdout II
You are viewing a single comment's thread. Return to all comments →
i have a question if u try s = sc.hansNext(); , it ouptputs the 1st word in the next line's string , shouldn't it also read the enter key ( empty output) instead of jumping to the next like nextLine() did in our case.
next() places the cursor in the same line after reading the input.
nextLine() positions the cursor in the next line ater reading output