This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
hi all, is it possible to make an Object immutable ?? for eg. consider an Object Object obj = something(); if i call obj.toString() does it make this object immutable ?? becoz toString() returns String and String is immutable right ?? Plz guide me if im wrong.. is there any other way to make an Object immutable ?? thanks, raj
SCJP, SCWCD, SCBCD, Oracle Certified Professional (SQL n PL/SQL)
Hi Rajeev, I only have little understanding about your question, hope this help. Immutable object is object that can't be modified. You can achieve this by making all fields private and make no method that can modify the fields. The fields is only set during the creation of the object. Susilo