Top "Java.util.scanner" questions

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

Java, try-catch with Scanner

I am creating a small algorithm and this is a part of it. If the user enters non integer values, …

java input try-catch java.util.scanner inputmismatchexception
Use File or FileReader with Scanner?

Disclaimer: I've looked through all the questions I can find and none of them answers this exact question. If you …

java file-io java.util.scanner
Java: scanning string for a pattern

This is probably a quicky. Why does this code not return anything? import java.util.Scanner; public class MainClass { public …

java java.util.scanner
Scanner NoSuchElementException

I'm having a problem with my Java assignment. I'm getting an unexpected exception, specifically: java.util.NoSuchElementException: No line found …

java exception java.util.scanner
How do i input a string from a buffered reader?

Im used too using Scanner mainly and want too try using a buffered reader: heres what i have so far …

java java.util.scanner bufferedinputstream
Regular Expression to Match " | "

I am trying to use Java's useDelimiter method on it's Scanner class to do some simple parsing. Basically each line …

java regex parsing java.util.scanner delimiter
How to get line number using scanner

I'm using scanner to read a text file line by line but then how to get line number since scanner …

java java.util.scanner
Difference between BufferedReader and BufferedInputStream

What are the differences between BufferedReader , BufferedInputStream and Scanner in java? BufferedReader reads the text and BufferedInputStream reads byte. Is …

java io java.util.scanner bufferedreader
How to use java.util.Scanner to correctly read user input from System.in and act on it?

This is meant to be a canonical question/answer that can be used as a duplicate target. These requirements are …

java java.util.scanner system.in
Delimiter in Scanner Java confusion

According to Java API Scanner uses delimiters to break the whole input into tokens. I am trying to understand the …

java java.util.scanner