Top "Java.util.scanner" questions

A simple text scanner in the JDK which can parse primitive types and strings using regular expressions.

Scanner doesn't read whole sentence - difference between next() and nextLine() of scanner class

I'm writing a program which allows the user to input his data then outputs it. Its 3/4 correct but when it …

java java.util.scanner
Extract Integer Part in String

What is the best way to extract the integer part of a string like Hello123 How do you get the 123 …

java string parsing integer java.util.scanner
Try/catch in Java

Could someone please give me a hint why this try and catch is not working? It throws a scanner exception …

java exception exception-handling try-catch java.util.scanner
How to test for blank line with Java Scanner?

I am expecting input with the scanner until there is nothing (i.e. when user enters a blank line). How …

java java.util.scanner
Scanner doesn't see after space

I am writing a program that asks for the person's full name and then takes that input and reverses it (…

java java.util.scanner
Search a file for a String and return that String if found

How can you search through a txt file for a String that the user inputs and then return that String …

java io java.util.scanner
Java String Scanner input does not wait for info, moves directly to next statement. How to wait for info?

I am writing a simple program that prompts a user to enter a number of students, then asks the user …

java string java.util.scanner
How to determine when end of file has been reached?

I am trying to read text from a text file. I need help figuring out when the end of file …

java file file-io java.util.scanner
NoSuchElementException with Java.Util.Scanner

I am very new to Java but am working through the book Java: How to program (9th ed.) and have …

java java.util.scanner
What does Scanner input = new Scanner(System.in) actually mean?

Scanner input = new Scanner(System.in); Could you give me a detailed explanation on what the code above is doing …

java input java.util.scanner