About 59 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 - 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 …

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

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

  6. Read words using scanner in Java - Stack Overflow

    May 6, 2015 · i wish to read multiple inputs on a single line in java. Ex: System.out.print("Input name, age, address, city: "); user will input these details separated with space what is …

  7. eclipse - how to import java.util.Scanner - Stack Overflow

    Jun 20, 2021 · how to import java.util.Scanner Asked 4 years, 6 months ago Modified 4 years, 6 months ago Viewed 10k times

  8. How to read strings from a Scanner in a Java console application?

    Jul 17, 2013 · System.out.println("Enter EmployeeName:"); ename=(scanner.nextLine()); This is because next () grabs only the next token, and the space acts as a delimiter between the …

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

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