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

    To use the Scanner class, create an object of the class and use any of the available methods found in the Scanner class documentation. In our example, we will use the nextLine() method, …

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

    Returns true if the next token matches the pattern constructed from the specified string. The scanner does not advance past any input. An invocation of this method of the form …

  3. Java Scanner String input - Stack Overflow

    Mar 22, 2012 · I'm writing a program that uses an Event class, which has in it an instance of a calendar, and a description of type String. The method to create an event uses a Scanner to …

  4. java - How to use Scanner methods when scanning a String

    Mar 9, 2016 · Scanner Line = new Scanner(lineString); //scans the String retrieved from the text file. while (Line.hasNextInt()) { //do stuff } So I have a scanner (textScan) that scans the first …

  5. java.util.scanner - Java: scanning string for a pattern - Stack Overflow

    May 15, 2011 · Scanner sc = new Scanner("asda ASA adad"); String pattern = "[A-Z]+"; while ((sc.hasNext(pattern))) { System.out.println(sc.next(pattern)); sc.close(); } catch (Exception e) { …

  6. Java User Input – Scanner Class - GeeksforGeeks

    Apr 22, 2025 · Import the Scanner class using import java.util.Scanner; Create the Scanner object and connect Scanner with System.in by passing it as an argument i.e., Scanner sc = new …

  7. 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 …

  8. Scanning (The Java™ Tutorials > Essential Java Classes - Oracle

    To see how scanning works, let's look at ScanXan, a program that reads the individual words in xanadu.txt and prints them out, one per line. public static void main(String[] args) throws …

  9. Java Scanner String input example - TheServerSide

    Jul 23, 2022 · Java's Scanner class provides a simple and effective way to handle user input. In this simple example, we show how to use Java's Scanner for String input with methods like …

  10. Java Scanner class with examples - BeginnersBook

    Sep 11, 2022 · In this guide, we will discuss java Scanner class methods as well as examples of some of the important methods of this class. The Scanner class is present in the java.util …

  11. Some results have been removed