By the way, let me just add another excellent example which will clear everybody's concept about String literals:
Here it goes:
produces the output:
true true true true false true
This example illustrates six points:
Literal strings within the same class (�8) in the same package (�7) represent references to the same String object (�4.3.1).
Literal strings within different classes in the same package represent references to the same String object.
Literal strings within different classes in different packages likewise represent references to the same String object.
Strings computed by constant expressions (�15.28) are computed at compile time and then treated as if they were literals.
Strings computed at run time are newly created and therefore distinct.
The result of explicitly interning a computed string is the same string as any pre-existing literal string with the same contents.
Hope this helps all of us for the exam
-sampaths77
[I added UBB CODE tags to your source code to make it more readable. Please try to use them in the future.
Learn more about UBB codes - Ajith]
[This message has been edited by Ajith Kallambella (edited September 15, 2000).]