About 42,800 results
Open links in new tab
  1. Why is String immutable in Java? - Stack Overflow

    Mar 14, 2014 · The reasons for choosing immutable strings are outlined below, and the string pool is a working strategy because of that. Still, your answer is not incorrect, it just doesn't seem complete. …

  2. java - String is immutable. What exactly is the meaning ... - Stack ...

    Jan 10, 2012 · immutable in the sense of memory. It creates new objects every time you create strings or assign a new string/change the value. That's why it is advisable to be careful when using strings. …

  3. Immutability of Strings in Java - Stack Overflow

    Now, in Java, Strings are immutable. Then how come the object str can be assigned with a different value like "Help!". Isn't this contradicting the immutability of strings in Java? Can anybody please …

  4. java - What is meant by immutable? - Stack Overflow

    Nov 11, 2008 · 423 What exactly does immutable mean - that is, what are the consequences of an object being mutable or immutable? In particular, why are Java's String s immutable? My …

  5. Why are strings immutable in many programming languages?

    Jun 8, 2014 · In Java not only String but all primitive Wrapper classes (Integer, Double, Character etc) are immutable. I am not sure of the exact reason but I think these are the basic data types on which …

  6. Is a Java string really immutable? - Stack Overflow

    Jan 6, 2014 · The implementation of String.substring(int, int) changed with Java 7u6. Before 7u6, the JVM would just keep a pointer to the original String 's char[] together with an index and length.

  7. Why can't strings be mutable in Java and .NET? - Stack Overflow

    Why is it that they decided to make String immutable in Java and .NET (and some other languages)? Why didn't they make it mutable?

  8. java - Why do we need immutable class? - Stack Overflow

    Immutable classes are in general much simpler to design, implement and use correctly. An example is String: the implementation of java.lang.String is significantly simpler than that of std::string in C++, …

  9. What is difference between mutable and immutable String in java

    Aug 5, 2014 · Java String s are immutable. In your first example, you are changing the reference to the String, thus assigning it the value of two other Strings combined: str + " Morning".

  10. Why is the String class declared final in Java? - Stack Overflow

    A String is a Final class & its immutable because it can't be changed but can be referred to another object. but what about:- String a = new String ("test1"); then, s = "test2"; If String is Final class object …