/*
 * Class to demonstrate some properties of reference types
 *
 * @author Nancy Harris
 * @version V1
 */
public class StringPlay
{
	/*********************************************************************
	 * A main method to demonstrate incoming command line arguments
	 * @param args An array of String that may be empty or may contain
	 *             values that we will use in a program
	 ********************************************************************/
	public static void main(String args[])
	{
		String s1, s2;

		s1 = "CS 239";  // assign the literal to the String variable
		s2 = s1;
		
		if (s1 == s2)
			System.out.printf("1 - s1 and s2 are aliases of same object");
		else
			System.out.printf("1 - s1 and s2 are different objects");
			
		s1 = new String("CS 239");  // assign a new String object 
		s2 = new String("CS 239");
		
		if (s1 == s2)
			System.out.printf("2 - s1 and s2 are aliases of same object");
		else
			System.out.printf("2 - s1 and s2 are different objects");

		s1 = "CS 239";		// assign the same literal 
		s2 = "CS 239";
		
		if (s1 == s2)
			System.out.printf("3 - s1 and s2 are aliases of same object");
		else
			System.out.printf("3 - s1 and s2 are different objects");
	}
}