class Alias  
{
	public static void main (String[] args)
	{	
		String strA;  // reference to the object
		String strB;  // another reference to the object
    
		// Create the only object and save its
		//   reference in strA
		strA = new String("only one string");
		System.out.println(strA); 

		strB = strA;  // copy the reference to strB.                             
		System.out.println(strB);
	}
}

Back to Lesson 10 Examples

Back to Java Main Page