File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes String Output related. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "String Output related." Watch "String Output related." New topic
Author

String Output related.

Pinki Roy
Greenhorn

Joined: May 16, 2008
Posts: 22



I do not understand why this is giving the output of False. Please explain.
Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 9383
    
    2

This is a good chance for you to explore a little bit and understand the ideas behind reference equality, object equality and perhaps String immutability.


SCJP 1.4, SCWCD 1.4 - Hints for you, Certified Scrum Master
Did a rm -R / to find out that I lost my entire Linux installation!
Rahul Shinde
Greenhorn

Joined: Jan 29, 2002
Posts: 9
The String class is immutable, once it is created a String object cannot be changed.

You might want to do .equals() instead to check for contents. i.e.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: String Output related.