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();
System.out.println(message1);
// "Hotdogs and Hamburgers!" --> Hotdogs and Hamburgers!
String message2 = console.next();
System.out.println(message2);
// "Hotdogs and Hamburgers!" --> Hotdogs