About 50 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. How to take input using Scanner in java? - Stack Overflow

    Feb 25, 2019 · I am taking input using java Scanner by writing following code: import java.util.Scanner; class main { public static void main (String args []) { Scanner scan=new Scanner (System.in);

  3. How to read integer value from the standard input in Java

    Mar 24, 2010 · The question is "How to read from standard input". A console is a device typically associated to the keyboard and display from which a program is launched. You may wish to test if no …

  4. How to get the user input in Java? - Stack Overflow

    Mar 13, 2011 · I attempted to create a calculator, but I can not get it to work because I don't know how to get user input. How can I get the user input in Java?

  5. java - Getting Keyboard Input - Stack Overflow

    Jul 9, 2013 · Scanner package used for obtaining the input of the primitive types like int, double etc. and strings. It is the easiest way to read input in a Java program, though not very efficient. To create an …

  6. java - Getting User input with Scanner - Stack Overflow

    Oct 21, 2012 · The problem with the code above, which also happens on different methods I tried, is that when the user types Y, the Scanner will skip the first input for first name,and jump to the surname.

  7. Clearing Scanner Buffer Java - Stack Overflow

    Dec 9, 2021 · When working with nextInt() and nextLine() in java, do I need to clear the input buffer after using a series of nextInt() for instance Scanner input = new Scanner(System.in); int age = input.nextIn...

  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 take in a month, …

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

    I'm taking user input from System.in using a java.util.Scanner. I need to validate the input for things like: It must be a non-negative number It must be an alphabetical letter ... etc What's the b...

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