Top "Java.util.scanner" questions

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

Why am I getting InputMismatchException?

So far I have this: public double checkValueWithin(int min, int max) { double num; Scanner reader = new Scanner(System.in); …

java input java.util.scanner inputmismatchexception
Java Scanner class reading strings

I got the following code: int nnames; String names[]; System.out.print("How many names are you going to save: "); …

java string duplicates java.util.scanner
Scanner vs. StringTokenizer vs. String.Split

I just learned about Java's Scanner class and now I'm wondering how it compares/competes with the StringTokenizer and String.…

java java.util.scanner tokenize split
Why can't I enter a string in Scanner(System.in), when calling nextLine()-method?

How does this program actually work...? import java.util.Scanner; class string { public static void main(String a[]){ int a; …

java user-input java.util.scanner
how to read a text file using scanner in Java?

This is my code to read a text file. When I run this code, the output keeps saying "File not …

java java.util.scanner
How to read a text file directly from Internet using Java?

I am trying to read some words from an online text file. I tried doing something like this File file = …

java file text-files java.util.scanner
Java using scanner enter key pressed

I am programming using Java. I am trying write code which can recognize if the user presses the enter key …

java input console java.util.scanner bufferedreader
Scanner method to get a char

What is the Scanner method to get a char returned by the keyboard in Java. like nextLine() for String, nextInt() …

java char java.util.scanner
Exception in thread "main" java.util.NoSuchElementException

Whenever I run this, the chooseCave() function works fine with the in.nextInt(). When I choose the cave, the messages …

java exception java.util.scanner
java.util.NoSuchElementException - Scanner reading user input

I'm new to using Java, but I have some previous experience with C#. The issue I'm having comes with reading …

java input java.util.scanner