Top "Java.util.scanner" questions

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

How to determine the end of a line with a Scanner?

I have a scanner in my program that reads in parts of the file and formats them for HTML. When …

java java.util.scanner delimiter
Java Scanner question

How do you set the delimiter for a scanner to either ; or new line? I tried: Scanner.useDelimiter(Pattern.compile("(\…

java regex java.util.scanner
Why is hasNext() False, but hasNextLine() is True?

Question How is it that for a scanner object the hasNextLine() method returns true while the hasNext() method returns false? …

java java.util.scanner
What does scanner.close() do?

Say I have the following example code: Scanner scan1 = new Scanner(System.in); // declaring new Scanner called scan1 int x = …

java java.util.scanner
java.io.FileNotFoundException (File not found) using Scanner. What's wrong in my code?

I've a .txt file ("file.txt") in my netbeans "/build/classes" directory. In the same directory there is the .class …

java java.util.scanner filenotfoundexception
How to put Input on next line in Java's Scanner utility

I have a basic java question about the scanner utility. Let's say i have a simple program that takes the …

java java.util.scanner println
Java "import java.util.Scanner" not working

This is my first time coding, so I'm sorry if I caused you to facepalm. I wanted to use the …

java netbeans java.util.scanner netbeans-8.1
Java input date from Scanner in one line

I'm trying to read date from a user to pass to GregorianCalendar variable. Currently I have an awkward setup, where …

java java.util.scanner gregorian-calendar
How to quickly search a large file for a String in Java?

I am trying to search a large text file (400MB) for a particular String using the following: File file = new …

java io java.util.scanner
Close a Scanner linked to System.in

I have a Scanner linked to System.in. Now, after using the Scanner, I should close it, as it is …

java java.util.scanner