Top "Java.util.scanner" questions

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

How can I read input from the console using the Scanner class in Java?

How could I read input from the console using the Scanner class? Something like this: System.out.println("Enter your …

java java.util.scanner
Take a char input from the Scanner

I am trying to find a way to take a char input from the keyboard. I tried using: Scanner reader = …

java input char java.util.scanner
Using scanner.nextLine()

I have been having trouble while attempting to use the nextLine() method from java.util.Scanner. Here is what I …

java java.util.scanner
Reading a .txt file using Scanner class in Java

I am working on a Java program that reads a text file line-by-line, each with a number, takes each number …

java file-io java.util.scanner
Scanner is skipping nextLine() after using next() or nextFoo()?

I am using the Scanner methods nextInt() and nextLine() for reading input. It looks like this: System.out.println("Enter …

java io java.util.scanner
How to put a Scanner input into an array... for example a couple of numbers

Scanner scan = new Scanner(System.in); double numbers = scan.nextDouble(); double[] avg =..????

java arrays java.util.scanner
Validating input using java.util.Scanner

I'm taking user input from System.in using a java.util.Scanner. I need to validate the input for things …

java validation java.util.scanner
How do I use a delimiter with Scanner.useDelimiter in Java?

sc = new Scanner(new File(dataFile)); sc.useDelimiter(",|\r\n"); I don't understand how delimiter works, can someone explain this …

java java.util.scanner delimiter
Java Scanner String input

I'm writing a program that uses an Event class, which has in it an instance of a calendar, and a …

java string java.util.scanner
What's the difference between next() and nextLine() methods from Scanner class?

What is the main difference between next() and nextLine()? My main goal is to read the all text using a …

java java.util.scanner