About 1,670,000 results
Open links in new tab
  1. Java User Input (Scanner class) - W3Schools

    The Scanner class is used to get user input, and it is found in the java.util package. To use the Scanner class, create an object of the class and use any of the available methods found in the …

  2. java - Scanner input data types - Stack Overflow

    Use Scanner.next(Pattern) and pass Pattern.compile("[A-Za-z0-9]") to let scanner accept only 1 character defined. You can pass any regex as argument and check for next() Scanner.next(); …

  3. Scanner (Java Platform SE 8 ) - Oracle Help Center

    A simple text scanner which can parse primitive types and strings using regular expressions. A Scanner breaks its input into tokens using a delimiter pattern, which by default matches …

  4. Scanner Class in Java - GeeksforGeeks

    Apr 11, 2025 · In Java, the Scanner class is present in the java.util package is used to obtain input for primitive types like int, double, etc., and strings. We can use this class to read input …

  5. Java Scanner (With Examples) - Programiz

    Here, we have created objects of the Scanner class that will read input from InputStream, File, and String respectively. The Scanner class provides various methods that allow us to read …

  6. Java Scanner Class Methods - Java Guides

    The Scanner class in Java is used for parsing primitive types and strings using regular expressions. This class can be used to read input from various sources like input streams, …

  7. Scanner Class in Java (With Examples) - FavTutor

    Oct 25, 2023 · You can pass a string as a parameter to the Scanner constructor to initialize a Scanner object for string input. Here's an example of using the Scanner constructor with a …

  8. Mastering Java Scanner: A Comprehensive Guide

    The Java Scanner class is an essential tool for reading user input from various sources, including keyboard input, files, and streams. It provides methods to parse primitive types and strings …

  9. java - how to read int,double,and sentence of string using same scanner

    Oct 5, 2015 · Scanner scan = new Scanner(System.in); int i = scan.nextInt(); double d = scan.nextDouble(); scan.nextLine(); String s = scan.nextLine(); System.out.println("String: " + …

  10. Reading User Input in Java with the Scanner Class - myCompiler

    The data types and the corresponding methods of the Scanner class to read a particular data type, as well as detect if an input is of the valid data type, are given below: Data type Method …

  11. Some results have been removed
Refresh