Source code for StringEqualsExample.java:

public class StringEqualsExample
{
	public static void main(String args[])
	{
		// StringEqualsExample
		String S = new String("Java");
		System.out.println(S == "Java");
	}
}

Output from StringEqualsExample.java:

false

--- Output Ends ---

NOTE:

You are reading previously generated output. You are not currently running the StringEqualsExample application at the momement. You need to compile and run the source code first.

To run this program:


Authors: Kevin Chu and Eric Brower
Copyright 2000 Prentice Hall PTR