<<< Online Scanner documentation and tutorials | Index | Using Java API >>> |
The Scanner object takes input (for example, from the keyboard,) and converts it to the internal format of an int, double, or a String. The common Scanner methods are:
Scanner sc = new Scanner(System.in); String name = sc.next(); int count = sc.nextInt(); double subtotal = sc.nextDouble(); String cityName = sc.nextLine();
See also Scanner samples for more details.
<<< Online Scanner documentation and tutorials | Index | Using Java API >>> |