System.out.print("Enter full name: "); //Create scanner object and read the value from the console Scanner scan = new Scanner(System.in); //Read the first token String firstName = scan.next(); //Read the second token String lastName = scan.next(); //Print the token values read by Scanner object System.out.println("First Name is: "+firstName); System.out.println("Last Name is: "+lastName); scan.close();
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter