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.
|Java - Interview Questions and Answers|
|Ans. 1. Security and Safety - They can be shared across multiple threads as they are thread safe. Moreover, it protects then from bad state due to interception by the other code segment. One such problem due to mutability and access by alternate code segment could be the change of hash code and then the impact on its search with hash collections.|
2. Reuse - In some cases they can be reused as only one copy would exist and hence it can be relied upon. For example - String Pool
|Help us improve. Please let us know the company, where you were asked this question :|
|Like Discuss Correct / Improve  immutable  immutability objects Asked in 1 Companies Intermediate   frequent|
|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 Object ?|
|What is an immutable class ?|
|Does Declaring an object "final" makes it immutable ?|
|What are stateless objects ? How are they different from immutable objects ? Which of these two is thread safe ?|
|What are advantages of stateless and / or immutable objects ?|