Welcome to the CSC Q&A.
Get help and give help!
Write great code!
It is our choices... that show what we truly are, far more than our abilities.


+17 votes
asked in CSC211_Winter2018 by (8 points)

1 Answer

+11 votes

I'm not sure what you're asking, but if you're trying to have the Scanner console store an entire String, then yes, you would use console.nextLine();. Alternatively, if you're trying to identify a token in a string, you could use console.next(); to store the next complete token.

Brief example:

String message1 = console.nextLine();
// "Hotdogs and Hamburgers!" --> Hotdogs and Hamburgers!

String message2 = console.next();
// "Hotdogs and Hamburgers!" --> Hotdogs
answered by (8 points)

yeah basically