About 117,000 results
Open links in new tab
  1. Java and enum with scanner - Stack Overflow

    Mar 6, 2012 · You don't have any problem with enums. At the moment you have a problem with user input, and not a very clear one.

  2. Scanning double with Scanner in Java from Console

    Aug 1, 2016 · I want to read a double number from standard input, but I always get this exception: java.util.InputMismatchException import java.util.Scanner; public class ScanDouble { public …

  3. string - Read date in Java with Scanner - Stack Overflow

    Dec 12, 2013 · Well, i'm trying to read a string with scanner in the same line. For exapme ,i want to read: Monday 12 December 2013 and this needs to be put in a String variable so as to help …

  4. How to input a sentence in Java - Stack Overflow

    Jan 13, 2020 · The code I have written takes as input just a single string and not a whole sentence and I want a whole sentence to be taken as input: import java.util.Scanner; public …

  5. java - print string by using Scanner class - Stack Overflow

    Aug 20, 2016 · I am giving this input "Welcome to HackerRank's Java tutorials!" into but printing only "Welcome" string through scanner class. import java.util.Scanner; public class Solution { …

  6. java - Using scanner input in getters and setters? - Stack Overflow

    Sep 23, 2019 · I have two java classes, while one contains the getters and setters the other is a driver class. I need the user input from the scanner in the driver class to be in one of the …

  7. java - Read line with Scanner - Stack Overflow

    Dec 1, 2013 · scanner.useDelimiter(System.getProperty("line.separator")); You have to check whether there is a next token available and then read the next token. You will also need to …

  8. java - Read CSV with Scanner () - Stack Overflow

    Else it will default to using all white space as its delimiter. Better though as has already been stated -- use a CSV library since this is what they do best. For example, this delimiter will split …

  9. How to get boolean user input using scanner? - Stack Overflow

    Feb 6, 2015 · So i have to ask the user whether they are above 18 and they have to answer with a true or false. And keep looping until they enter the right input So far, i have this boolean b = …

  10. java - Use of Scanner class in recursive functions - Stack Overflow

    Apr 27, 2014 · Maybe. The best approach for a command line tool would probably to use just a single instance of the Scanner using System.in instead of creating them for each method call.

Refresh