/**
* Scanner demo with some problems.
*
* @author Terry Sergeant
* @version In Class Demo
*
* Do the following steps and write answers to each of the four
* questions/instructions:
*
* 1. Compile and run this program. When prompted enter: Sam Houston for
* the name and enter 89 for the age. What happens?
* 2. Re-run the program and enter the Geronimo for name and enter 45 for
* age. What happens?
* 3. Explain what you observed in steps 1 and 2 in terms of the input
* buffer, the buffer pointer, and the behavior of Scanner.
* 4. Modify this program so that it will work regardless of whether
* the name entered is a full name or just a first name. Put your
* answers to the first three questions in the comment header.
*/
import java.util.Scanner;
public class ScannerErr1
{
public static void main(String [] args)
{
Scanner keyboard= new Scanner(System.in);
String name;
int age;
System.out.print("Enter your name: ");
name= keyboard.next();
System.out.print("Enter your age : ");
age= keyboard.nextInt();
System.out.println("Name: "+name);
System.out.println("Age : "+age);
}
}