Being new to Java, one of the resources you need to have on hand is the Oracle documentation pages, for example:
https://docs.oracle.com/javase/7/docs/api/java/util/Scanner.html
That will guide you on what a Scanner
can do.
Specifically, you should look for
.nextLine()