About 9,280,000 results
Open links in new tab
  1. java.util.scanner - How can I read input from the console using the ...

    This Scanner class comes under java.util, hence the first line of the program is import java.util.Scanner; which allows the user to read values of various types in Java.

  2. java - Take a char input from the Scanner - Stack Overflow

    Dec 19, 2012 · Scanner reader = new Scanner(System.in); char c = reader.nextChar(); This method doesn't exist. I tried taking c as a String. Yet, it would not always work in every case, …

  3. input - Java, try-catch with Scanner - Stack Overflow

    0 you simply can use the hasNext (); method in java, instead of try and catch. The hasNext () is a method of Java Scanner class that returns true if this scanner has another token in its input.

  4. How can I clear the Scanner buffer in Java? - Stack Overflow

    May 15, 2012 · As comments point out, however, sometimes System.in input can be multi-line. You can instead create a new Scanner object where you want to clear the buffer if you are …

  5. Reading a .txt file using Scanner class in Java - Stack Overflow

    I am working on a Java program that reads a text file line-by-line, each with a number, takes each number throws it into an array, then tries and use insertion sort to sort the array. I need help w...

  6. Java using scanner with try-with-resources - Stack Overflow

    Dec 1, 2017 · You can use every class thats implements Closeable or AutoCloseable in try-with-resources, When code reaches the end of the try call, It call close() function of the Scanner …

  7. Validating input using java.util.Scanner - Stack Overflow

    How to use java.util.Scanner to correctly read user input from System.in and act on it? (1 answer)

  8. java - How to put a Scanner input into an array... for example a …

    Jul 10, 2018 · Scanner scan = new Scanner(System.in); double numbers = scan.nextDouble(); double[] avg =..????

  9. java - Reading UTF-8 characters using Scanner - Stack Overflow

    Aug 15, 2012 · Reading UTF-8 characters using Scanner Asked 13 years, 4 months ago Modified 9 years, 5 months ago Viewed 28k times

  10. java - Scanner is skipping nextLine () after using next () or nextFoo ...

    Aug 14, 2011 · That's because the Scanner.nextInt method does not read the newline character in your input created by hitting "Enter" and so the call to Scanner.nextLine returns after reading …