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

    import java.util.Scanner; class Main { public static void main(String[] args) { Scanner myObj = new Scanner(System.in); System.out.println("Enter name, age and salary:"); // String input String …

  2. java - print string by using Scanner class - Stack Overflow

    Aug 20, 2016 · printing only "Welcome" string through scanner class. import java.util.Scanner; public class Solution { public static void main(String[] args) { Scanner scan = new …

  3. java - making the user input a name for the class/scanner to store ...

    Aug 12, 2015 · Scanner scanner1 = new Scanner(System.in); System.out.println("Please enter your name: "); String characterName = scanner1.nextLine(); System.out.println("Hello, " + …

  4. java.util.scanner - How can I read input from the console using

    To retrieve a username I would probably use sc.nextLine(). You could also use next(String pattern) if you want more control over the input, or just validate the username variable. You'll …

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

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

  7. Java Scanner - Baeldung

    Jan 5, 2024 · We learned how to read input from a file, console, or String using Scanner. We also learned how to find and skip a pattern using Scanner and how to change the Scanner …

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

    Oct 25, 2023 · System.out.println("Hello, " + name + "!"); In the above example, we prompt the user to enter their name using System.out.print (). Then, we use scanner.nextLine () to read …

  9. Java User Input – Scanner Class - GeeksforGeeks

    Apr 22, 2025 · Follow these steps to take user input using Scanner class: When we want to ask the user for input, first print a prompt message so they know what to enter. Then use one of …

  10. How To Use Java Scanner Class - Complete Guide With Examples

    Oct 6, 2021 · We have covered all the details about the Java’s Scanner class, including how to import the Scanner class, how to create an object, and how to use the functions with various …

  11. Some results have been removed
Refresh