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

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

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

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

  7. java.util.scanner - Read next word in java - Stack Overflow

    Scanner sc = new Scanner(new File("translate.txt")); while(sc.hasNext()){ String line = sc.nextLine(); } Each line has two words. Is there any method in java to get the next word or do I have to split the line …

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

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

  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)