aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes String methods.... 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 methods...." Watch "String methods...." New topic
Author

String methods....

Nidhi Juneja
Greenhorn

Joined: Oct 07, 2002
Posts: 27
Hi folks...look at the following code...has put my concepts in doubt..

I don't understand why cond 2 returns false while cond 4 returns true. Can anyone put more light on this topic
[ Jess added UBB [CODE] tags to preserve whitespace ]
[ October 09, 2002: Message edited by: Jessica Sant ]
John McAlroy
Greenhorn

Joined: Oct 09, 2002
Posts: 4
Both, trim() and toUpperString() create a new string object ONLY IF there a change is required in the original string otherwise, same object is returned. So, 2 returns false while 4 returns true.
Nidhi Juneja
Greenhorn

Joined: Oct 07, 2002
Posts: 27
Thanks John but is it for only these 2 methods or for all the string class methods.....
Nidhi Juneja
Greenhorn

Joined: Oct 07, 2002
Posts: 27
I have tried a number of questions and i think it is a basic rule for all methods ....correct me if i am wrong
sun par
Ranch Hand

Joined: Oct 03, 2002
Posts: 257
In String class this holds for substring also if the whole string is returned as a result of the operation


Sunita<br />SCJP 1.4
Thomas Paul
mister krabs
Ranch Hand

Joined: May 05, 2000
Posts: 13974
Just take a look at the API. It tells the full story.


Associate Instructor - Hofstra University
Amazon Top 750 reviewer - Blog - Unresolved References - Book Review Blog
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: String methods....