/**
 * Scanner with some more 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 89 for the age and
 *    enter Sam Houston for the name.  What happens?
 * 2. Explain what you observed in steps 1 in terms of the input
 *    buffer, the buffer pointer, and the newline character.
 * 3. Modify this program so that it will work correctly ... i.e., the
 *    user should be able to enter a full name ... and, of course, an
 *    age.  Do *not* change the order of the input statements!  Put your
 *    answers to the first three questions in the comment header.
*/

import java.util.Scanner;

public class ScannerErr2
{
	public static void main(String [] args)
	{
		Scanner keyboard= new Scanner(System.in);
		String name;
		int    age;

		System.out.print("Enter your age : ");
		age= keyboard.nextInt();
		System.out.print("Enter your name: ");
		name= keyboard.nextLine();

		System.out.println("Age : "+age);
		System.out.println("Name: "+name);
	}
}

