About 3,470,000 results
Open links in new tab
  1. How to use the same Scanner across multiple classes in Java

    Mar 29, 2015 · Simply use public static final Scanner in = new Scanner(System.in); in you main class. After that you can call it from anywhere by MainClassName.in . Also, be careful with arguments you pass to Scanner.

    Missing:

    • Leaf Classes

    Must include:

  2. 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 Scanner class documentation.

    Missing:

    • Leaf Classes

    Must include:

  3. 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 from a user or a file. In this article, we cover how to take …

    Missing:

    • Leaf Classes

    Must include:

  4. Java Scanner class with examples - BeginnersBook

    Sep 11, 2022 · In this tutorial, you will learn Java Scanner class and how to use it in java programs to get the user input. This is one of the important classes as it provides you various methods to capture different types of user entered data.

    Missing:

    • Leaf Classes

    Must include:

  5. Java User Input – Scanner Class - GeeksforGeeks

    Apr 22, 2025 · It is a part of java.util package. The scanner class can handle input from different places, like as we are typing at the console, reading from a file, or working with data streams. This class was introduced in Java 5. Before that, we used the BufferedReader class (introduced in Java 1.1). As a beginner, we will suggest to use Scanner class ...

    Missing:

    • Leaf Classes

    Must include:

  6. java - Using scanner in multiple classes - Stack Overflow

    Jul 31, 2016 · public static Scanner scan = new Scanner(System.in); Call the scan object from any class you want by using this example: String input = MyStatics.scan.nextLine();

    Missing:

    • Leaf Classes

    Must include:

  7. Java Scanner Class and Its Methods (with Examples)

    In this tutorial, we will learn about the Scanner class, its methods, their usages, syntaxes, and examples. Scanner class. It is used to create an object which is used to read data from input stream (keyboard). Scanner class is defined in java.util package. So, we need to import this packet first before using the methods of Scanner class.

    Missing:

    • Leaf Classes

    Must include:

  8. Basic input using Scanner class in Java - Codeforwin

    Jun 14, 2018 · Write a java program to perform basic input using Scanner class. In this article I will explain how to input all basic data types using Scanner class in Java. We will learn how to use java.util.Scanner class to input data from user.

    Missing:

    • Leaf Classes

    Must include:

  9. Scanner Class in Java? Methods & Example Programs [ 2025 ]

    Jan 6, 2024 · What is the Scanner class in Java? The Java Scanner class is mostly used to get input from the user. It’s located in the java.util package. The Scanner class not only extends the Object class but can also implement Iterator and Closeable interfaces. By default, it breaks up the user input into tokens using whitespace as a delimiter.

    Missing:

    • Leaf Classes

    Must include:

  10. scanner - Java - OneCompiler

    Using Scanner class in Java program, you can read the inputs. Following is a sample program that shows reading STDIN ( A string in this case ). import java.util.Scanner; class Input { public static void main(String[] args) { Scanner input = new Scanner(System.in); System.out.println("Enter your name: "); String inp = input.next(); System.out ...

    Missing:

    • Leaf Classes

    Must include: