/*
 * Code10.java
 * Dan Armendariz
 * Computer Science S-76
 *
 * String input and comparison - fixed!
 *
 */

// allow us use of the keyboard scanner. More information from the docs:
// http://java.sun.com/javase/6/docs/api/java/util/Scanner.html
import java.util.Scanner;

class Code10 {

	public static void main(String [] args) {

		String str = "Hello, world";
		String input = null;

		// instantiate the Scanner class, accessing data from the keyboard
		Scanner keyboard = new Scanner(System.in);

		System.out.print("Please type a string: ");		

		// wait for the user to enter an integer
		try {
			input = keyboard.nextLine();
		} catch(Exception e) {
			System.out.println("Invalid input! Quitting..");
			System.exit(1);
		}

		// test to see if what the user entered matches our string, using
		// the equals method.
		if(str.equals(input)) {
			System.out.println("Strings match! :-)");
		} else {
			System.out.println("Strings do not match! :-(");
		}

	}

}