This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes testing String as immutable Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "testing String as immutable" Watch "testing String as immutable" New topic
Author

testing String as immutable

Mike Cunningham
Ranch Hand

Joined: Nov 14, 2000
Posts: 129
Is there a way to test that a String is immutable by attempting to change the actual string object in the constant pool?
R K Singh
Ranch Hand

Joined: Oct 15, 2001
Posts: 5371
mean ??


"Thanks to Indian media who has over the period of time swiped out intellectual taste from mass Indian population." - Chetan Parekh
WiLL Tao
Ranch Hand

Joined: Dec 14, 2001
Posts: 56
Is this code ok?
because "==" is shallow compare,so if string is mutable, the refence address will not be changed.
but this code provdes m1 create new ojbect.


Thank Folks who <b>Make Sense</b> here.<br />SCJP Platform 2
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: testing String as immutable
 
Similar Threads
why string
StringBuffer and String returned from a method doubt
Immutable classes
How is this possible if Strings are immutable?
StringBuffer question