About 36,900,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. java - What does Scanner input = new Scanner (System.in) actually …

    Jun 3, 2015 · 0 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 …

  4. java - Getting Keyboard Input - Stack Overflow

    Jul 9, 2013 · 12 You can use Scanner class To Read from Keyboard (Standard Input) You can use Scanner is a class in java.util package. Scanner package used for obtaining the input of …

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

  7. java - How to terminate Scanner when input is complete? - Stack …

    The reason your current version is failing is that you are using == to test for an empty String. You should use either the equals or isEmpty methods. (See How do I compare strings in Java?) …

  8. Java Scanner String input - Stack Overflow

    May 11, 2011 · 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 …

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

  10. 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)