/*
 * Author: Leong Lee
 * Created: Friday, 3 June, 2005 17:08:34
 * Modified: Friday, 3 June, 2005 17:08:34
 */


class EqualTest
{
// == !=   when comparing objects
// They determine whether both sides of the operator refer to the same object

	public static void main(String[] arguments){
		String str1, str2;
		str1 = "Free the bound periodicals.";
		str2 = str1;    //assign value, points to the same object
		
		System.out.println("String1: " + str1);
		System.out.println("String2: " + str2);
		System.out.println("Same object? " + (str1==str2));
		
		str2 = new String(str1);  //new string object, same value
		System.out.println("String1: " + str1);
		System.out.println("String2: " + str2);
		System.out.println("Same object? " + (str1==str2));
		System.out.println("Same value? "+ str1.equals(str2));	//equal method
	}
}
