I have two option to create a String which looks somethig like this, Can any one help me to know which is better ;
I know in the first case,
Number of immutable Object : 7
Number of mutable Object : 0
In second Case :
Number of Immutable Object : 5
Number of mutable Object : 1
So Over all i saved 2 immutable Object. If I have to create similar String 20 times in a program, I will save 20 Objects.
My query is that which one i should prefer to use while coding?
first one is easy to understand and use. Second one is more spacious and not easy to understand ?
Which one is generally prefer and why ?
I know in the first case,
Number of immutable Object : 7
Number of mutable Object : 0
In second Case :
Number of Immutable Object : 5
Number of mutable Object : 1
So Over all i saved 2 immutable Object. If I have to create similar String 20 times in a program, I will save 20 Objects.
My query is that which one i should prefer to use while coding?
first one is easy to understand and use. Second one is more spacious and not easy to understand ?
Which one is generally prefer and why ?