0% found this document useful (0 votes)
5 views2 pages

Ram Shayam

Uploaded by

Sahil Sharma
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views2 pages

Ram Shayam

Uploaded by

Sahil Sharma
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

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?

You might also like