Top "Java.util.scanner" questions

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

How to handle infinite loop caused by invalid input (InputMismatchException) using Scanner

So, I'm getting stuck with this piece of code: import java.util.InputMismatchException; import java.util.Scanner; public class ConsoleReader { …

java java.util.scanner infinite-loop
Java -- Closing Scanner and Resource Leak

I'm learning Java and working on some projects for fun. One issue that I have run in to is that …

java eclipse java.util.scanner
Java - Using multiple delimiters in a scanner

I'm using a scanner to take input and, hopefully, split it into chunks. I want it to split it up …

java java.util.scanner delimiter
How to stop reading multiple lines from stdin using Scanner?

I'm working on an JAVA assignment should process multiple lines of input. The instructions read "Input is read from stdin." …

java stdin java.util.scanner
How do I keep a Scanner from throwing exceptions when the wrong type is entered?

Here's some sample code: import java.util.Scanner; class In { public static void main (String[]arg) { Scanner in = new Scanner (…

java text-parsing java.util.scanner
Difference between buffered reader and file reader and scanner class

Can anyone explain me the difference between the class BufferedReader, FileReader and Scanner? and which one to use when I …

java java.util.scanner bufferedreader filereader
Code to tell whether a string is a Pangram or not?

import java.io.*; import java.util.*; public class Solution { public static final int n = 26; public int check(String arr) { if (…

java string java.util.scanner pangram
Can't use Scanner.nextInt() and Scanner.nextLine() together

I have to get a string input and an integer input, but there order of input should be that integer …

java java.util.scanner
Java scanner not going through entire file

I'm writing a program in Java and one of the things that I need to do is to create a …

java file-io java.util.scanner
Why does hasNextLine() never end?

Sorry if this sounds too simple. I'm very new to Java. Here is some simple code I was using to …

java java.util.scanner