10. Why String objects are immutable where as StringBuffer objects are mutable?
In the case of String as several references pointing to the same object, by using
one reference if we are allowed perform the change the remaining references will
be impacted. To prevent this once we created a String object we can't perform
any change in the existing object that is immutability is only due to SCP.
But in the case of StringBuffer for every requirement we are creating a separate
object will be created by using one reference if we are performing any change in
the object the remaining references won't be impacted hence immutability
concept is not require for the StringBuffer.
11. Similar to String objects any other objects are immutable in java?
In addition to String objects , all wrapper objects are immutable in java.
12. Is it possible to create our own mutable class?
Yes.
13. Explain the process of creating our own immutable class with an example?
14. What is the difference between final and immutability?
15. What is interning of String objects?10. Why String objects are immutable where
as StringBuffer objects are mutable?
In the case of String as several references pointing to the same object, by using
one reference if we are allowed perform the change the remaining references will
be impacted. To prevent this once we created a String object we can't perform
any change in the existing object that is immutability is only due to SCP.
But in the case of StringBuffer for every requirement we are creating a separate
object will be created by using one reference if we are performing any change in
the object the remaining references won't be impacted hence immutability
concept is not require for the StringBuffer.
11. Similar to String objects any other objects are immutable in java?
In addition to String objects , all wrapper objects are immutable in java.
12. Is it possible to create our own mutable class?
Yes.
13. Explain the process of creating our own immutable class with an example?
14. What is the difference between final and immutability?
15. What is interning of String objects?10. Why String objects are immutable where
as StringBuffer objects are mutable?
In the case of String as several references pointing to the same object, by using
one reference if we are allowed perform the change the remaining references will
be impacted. To prevent this once we created a String object we can't perform
any change in the existing object that is immutability is only due to SCP.
But in the case of StringBuffer for every requirement we are creating a separate
object will be created by using one reference if we are performing any change in
the object the remaining references won't be impacted hence immutability
concept is not require for the StringBuffer.
11. Similar to String objects any other objects are immutable in java?
In addition to String objects , all wrapper objects are immutable in java.
12. Is it possible to create our own mutable class?
Yes.
13. Explain the process of creating our own immutable class with an example?
14. What is the difference between final and immutability?
15. What is interning of String objects?10. Why String objects are immutable where
as StringBuffer objects are mutable?
In the case of String as several references pointing to the same object, by using
one reference if we are allowed perform the change the remaining references will
be impacted. To prevent this once we created a String object we can't perform
any change in the existing object that is immutability is only due to SCP.
But in the case of StringBuffer for every requirement we are creating a separate
object will be created by using one reference if we are performing any change in
the object the remaining references won't be impacted hence immutability
concept is not require for the StringBuffer.
11. Similar to String objects any other objects are immutable in java?
In addition to String objects , all wrapper objects are immutable in java.
12. Is it possible to create our own mutable class?
Yes.
13. Explain the process of creating our own immutable class with an example?
14. What is the difference between final and immutability?
15. What is interning of String objects?10. Why String objects are immutable where
as StringBuffer objects are mutable?
In the case of String as several references pointing to the same object, by using
one reference if we are allowed perform the change the remaining references will
be impacted. To prevent this once we created a String object we can't perform
any change in the existing object that is immutability is only due to SCP.
But in the case of StringBuffer for every requirement we are creating a separate
object will be created by using one reference if we are performing any change in
the object the remaining references won't be impacted hence immutability
concept is not require for the StringBuffer.
11. Similar to String objects any other objects are immutable in java?
In addition to String objects , all wrapper objects are immutable in java.
12. Is it possible to create our own mutable class?
Yes.
13. Explain the process of creating our own immutable class with an example?
14. What is the difference between final and immutability?
15. What is interning of String objects?10. Why String objects are immutable where
as StringBuffer objects are mutable?
In the case of String as several references pointing to the same object, by using
one reference if we are allowed perform the change the remaining references will
be impacted. To prevent this once we created a String object we can't perform
any change in the existing object that is immutability is only due to SCP.
But in the case of StringBuffer for every requirement we are creating a separate
object will be created by using one reference if we are performing any change in
the object the remaining references won't be impacted hence immutability
concept is not require for the StringBuffer.
11. Similar to String objects any other objects are immutable in java?
In addition to String objects , all wrapper objects are immutable in java.
12. Is it possible to create our own mutable class?
Yes.
13. Explain the process of creating our own immutable class with an example?
14. What is the difference between final and immutability?
15. What is interning of String objects?10. Why String objects are immutable where
as StringBuffer objects are mutable?
In the case of String as several references pointing to the same object, by using
one reference if we are allowed perform the change the remaining references will
be impacted. To prevent this once we created a String object we can't perform
any change in the existing object that is immutability is only due to SCP.
But in the case of StringBuffer for every requirement we are creating a separate
object will be created by using one reference if we are performing any change in
the object the remaining references won't be impacted hence immutability
concept is not require for the StringBuffer.
11. Similar to String objects any other objects are immutable in java?
In addition to String objects , all wrapper objects are immutable in java.
12. Is it possible to create our own mutable class?
Yes.
13. Explain the process of creating our own immutable class with an example?
14. What is the difference between final and immutability?
15. What is interning of String objects?