import java.util.Scanner; public class ScannerNextMethods { public static void main(String args[]){ Scanner scan = new Scanner ("I 1 1.66 am here today"); // String constructor for Scanner Object res1 = scan.next(); // scans any input value (as Object is the super class in Java) until the first space character int x = scan.nextInt(); // scans an integer value until the first space character Object res2 = scan.nextDouble(); // scans an double value until the first space character Object res3 = scan.nextLine(); // scans a String value until the end of the input String System.out.println ("res1 = " + res1); System.out.println ("x = " + x); System.out.println ("res2 = " + res2); System.out.println ("res3 = " + res3); scan.close(); // close the scanner } }