// NextLineIssue.java
// Earl Bergquist 
// Dec 6, 2011  Garfield HS
// This demonstrated a problem with using nextLine() after having used a next(), 
// nextInt() or nextDouble()
	 
   import java.util.*;	// for the Scanner
   import java.io.*;		// for FileIO exceptions

   public class NextLineIssue {
   
   // The main method prompts at the console for the an integer
   // and then for a line to be encoded
   // Then it prints out the key and line before coding it.
    
      public static void main(String[] args) throws FileNotFoundException {
      
      // declare a Scanner to read from the console
         Scanner console = new Scanner(System.in);
      
      // get the name of the file to be opened
         System.out.print("Enter the Key? ");
         String key = console.next();
         // console.nextLine(); // You need to add in this extra nextLine() to get past 
			                   // the new line after the next() getting the key string.

         System.out.print("Enter the Line to be Encoded? ");
         String line = console.nextLine();		
         	
      // Let's print what we found, this would NOT include this in your competition solution
         System.out.println("\nKey is: " + key + " Line is: \"" + line + "\"\n");
      
      }
   }
