aspose file tools*
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
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: 128
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: 5370
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
StringBuffer question
Immutable classes
How is this possible if Strings are immutable?
why string
StringBuffer and String returned from a method doubt