About 31,500,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, since the other …

  3. java - What does Scanner input = new Scanner (System.in) actually …

    Jun 3, 2015 · Scanner s = new Scanner(System.in); Above statement creates an object of Scanner class which is defined in java.util.scanner package. Scanner class allows user to take input from …

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

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

    May 15, 2012 · You can instead create a new Scanner object where you want to clear the buffer if you are using System.in and not some other InputStream. in = new Scanner(System.in);

  6. Java Scanner Input String - Stack Overflow

    Mar 3, 2017 · With a scanner, you use input.nextInt() for an int or input.nextDouble() for a double. Why do you use input.nextLine() for a String instead of input.nextString()?

  7. How to use scanner in java? - Stack Overflow

    Apr 12, 2014 · 3 First of all, Scanner objects doesn't hava a method called nexlinet, I guess you want nextLine() instead. About the error, you can't reference a non-static variable from a static method (in …

  8. java - How to use Scanner to accept only valid int as input - Stack ...

    Use Scanner.hasNextInt(): Returns true if the next token in this scanner's input can be interpreted as an int value in the default radix using the nextInt() method.

  9. NoSuchElementException with Java.Util.Scanner - Stack Overflow

    at java.util.Scanner.nextInt(Scanner.java:2050) at Addition.main(Addition.java:16) Enter First Integer: I understand that this is probably due to something in the source code that is incompatible with the …

  10. java - How to put a Scanner input into an array... for example a couple ...

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