About 42,600,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 …

  2. Scanner nextLine () method in Java with Examples

    Oct 12, 2018 · The nextLine () method of java.util.Scanner class advances this scanner past the current line and returns the input that was skipped. This function prints the rest of the current …

  3. java - How to get a whole line of input using scanner - Stack Overflow

    Sep 22, 2015 · Did you use your scanner instance before entering the condition? The following test code works: public static void main(String[] args) { Scanner scanner = new …

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

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

  6. Using scanner.nextLine() - W3docs

    Scanner.nextLine() is a method of the Scanner class in Java that reads a line of text from the input. Here's an example of how to use nextLine() to read a line of text from the console: …

  7. Java Scanner nextLine() Method - W3Schools

    The nextLine() method returns a string containing all of the characters up to the next new line character in the scanner, or up to the end of the scanner if there are no more new line …

  8. Java Scanner Tutorial and Code Examples - CodeJava.net

    Jul 29, 2019 · Basically, a Scanner breaks its input into tokens using a delimiter pattern, which by default matches whitespace (blanks, tabs, and line terminators). The parsed tokens can be …

  9. java - Read line with Scanner - Stack Overflow

    Dec 1, 2013 · public static void readFileByLine(String fileName) { try { File file = new File(fileName); Scanner scanner = new Scanner(file); while (scanner.hasNext()) { …

  10. Scanner Class in Java - GeeksforGeeks

    Apr 11, 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 …

Refresh