About 487,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. 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 …

  3. Java Scanner (With Examples) - Programiz

    The Scanner class of the java.util package is used to read input data from different sources like input streams, users, files, etc. In this tutorial, we will learn about the Java Scanner and its …

  4. Java User Input – Scanner Class - GeeksforGeeks

    Apr 22, 2025 · The most common way to take user input in Java is using the Scanner class. It is a part of java.util package. The scanner class can handle input from different places, like as we …

  5. Java Scanner - Baeldung

    Jan 5, 2024 · A quick and practical set of examples for using the core Scanner Class in Java - to work with Strings, Files and user input.

  6. How to Take String Input In Java using Scanner Class - Know …

    In this post, we will see how to take string input in java using the scanner class. See more:- String Programs In Java. There are two different options:- read one word or read one line. In the …

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

    Scanner sc = new Scanner(new File("myNumbers")); while (sc.hasNextLong()) { long aLong = sc.nextLong(); The scanner can also use delimiters other than whitespace. This example …

  8. Java Scanner String input example - TheServerSide

    Jul 23, 2022 · To take String input from the user with Java’s Scanner class, just follow these steps. The following example uses the Java Scanner class to take String input from the user: …

  9. Java User Input – Scanner, BufferedReader and Console - Intellipaat

    May 14, 2025 · Java offers a number of methods – Scanner, BufferedReader, and Console – to read various kinds of input such as strings, numbers, and characters. Each input method is …

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