InterviewSolution
| 1. |
What Is Immutable Class And How To Create An Immutable Class In Java ? |
|
Answer» An immutable class is one in which once an object is created, then we cannot alter the values, or we cannot change its content. As in Java, we have wrapper CLASSES like String, Boolean, Integer, etc., all these classes are immutable classes, and we can ALSO create an immutable class by own. Following are some REQUIREMENT to create an immutable class in Java:
An immutable class is one in which once an object is created, then we cannot alter the values, or we cannot change its content. As in Java, we have wrapper classes like String, Boolean, Integer, etc., all these classes are immutable classes, and we can also create an immutable class by own. Following are some requirement to create an immutable class in Java: |
|