public class compare
{
    public static void main( String[] args ) 
    {
	
	String foo = new String("hello");
	String bar = new String("hello");
	   
	System.out.println("Comparing with ==");
	System.out.println();
	
	if(foo==bar)
	    System.out.println("foo is the same as bar");
	else
	    System.out.println("foo and bar are different");
	
	System.out.println();
	
	System.out.println("Comparing with equals()");
	System.out.println();
	
	if(foo.equals(bar))
	    System.out.println("foo and bar contain the same string");
	else
	    System.out.println("foo and bar contain different strings");
    }

}
