Why String class is final and String objects are immutable?

String class objects are immutable,due to this  their contents can not be modified between various applications.so different applications can share the content of String class object.This is the reason that String class objects are immutable.
To maintain the immutable nature,none of the String class methods should be able to modify the contents of same object. So javasoft people didnot provide anyscope to override those String class methods.This is the reason String class is made final

0 comments :

Post a Comment