About 754,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 Scanner class documentation.

  2. How to input a sentence in Java - Stack Overflow

    Jan 13, 2020 · You can use nextLine() to input sentence in java. example : import java.util.Scanner; public class Solution { public static void main(String[] args) { Scanner scan = new Scanner(System.in); String s; s=scan.nextLine(); System.out.println("String: " + s); } }

  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 take in a month, day, year, hour, minute, and a description. The problem I'm having is that the Scanner.next () method only returns the first word before a space.

  4. Java User InputScanner 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 are typing at the console, reading from a file, or working with data streams.

  5. How to take input as String with spaces in java using scanner

    Sep 15, 2016 · One can use the delimiter function to segregate your input as shown below. import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in).useDelimiter("\n"); String input = scanner.next(); System.out.println(input); scanner.close(); } }

  6. 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 next(), nextLine() and ...

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

    While taking input from the end-user, String is one of the most regularly used values to take input for the program. In this post, we will see how to take string input in java using the scanner class.

  8. How to take String Input in Java - BeginnersBook

    Jun 9, 2024 · In this tutorial, we will learn how to take String input in Java. There are two ways you can take string as an input from user, using Scanner class and using BufferedReader. However most common way is using Scanner class. Let's see programs of each of these approaches: 1. String Input using Scanner Class In

  9. Read user input using the Scanner class - JAVAHANDSON

    Nov 27, 2023 · In this article, we will learn what is a Scanner class and how to read user input using the Scanner class with proper examples.

  10. How to take input from user in java using scanner

    Aug 19, 2016 · We can read input from the console using scanner class. Java.util.Scanner class provides lot of methods to take different typed of data from the user as input. Scanner class is final class in java like String class. Scanner class implements Iterator and Closeable interfaces.

  11. Some results have been removed
Refresh