What are the drawbacks of creating immutable objects ? Why don't we create all object immutable if mutability possesses so much threat ?
Javasearch.buggybread.com

Search Interview Questions


 More than 3000 questions in repository.
 There are more than 900 unanswered questions.
Click here and help us by providing the answer.
 Have a video suggestion.
Click Correct / Improve and please let us know.
Label / Company      Label / Company / Text

   



Interview Questions and Answers

 Q1. What are the drawbacks of creating immutable objects ? Why don't we create all object immutable if mutability possesses so much threat ? Core Java
Ans. Immutable objects relieves us from the problems of inconsistencies and security and helps with better read performance but at the same time are write performance and storage overheads. In case any modification is required , a new object is created and thus creating multiple copies of it.

This is the reason we use StringBuffer / StringBuilder when we have to append some text multiple times and then create a String out of it.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     immutable  immutability objects  immutability


Related Questions

  Why is String immutable in Java ?
  Why Char array is preferred over String for storing password?
 How does making string as immutable helps with securing information ? How does String Pool pose a security threat ?
 How is string object immutable if we can concat a string to it ?
  How to implement an immutable class ?
  What is an immutable class ?
  What is an Immutable Object ?
  Does Declaring an object "final" makes it immutable ?
 Is String final in Java ?
  What are stateless objects ? How are they different from immutable objects ? Which of these two is thread safe ?



Help us and Others Improve. Please let us know the questions asked in any of your previous interview.

Any input from you will be highly appreciated and It will unlock the application for 10 more requests.

Company Name:
Questions Asked: