Immutable.....?
Immutable objects......?
Immutable objects are instance whose state does not change after it has been initialized.
For example, one of our favourite class String is also immutable, that's why once it's instantiated its value never changed.
And all other wrapper classes(Integer, Boolean, Byte, Short) all are Immutable class.
There is some following way, by using that we can also make our own Immutable class.
Immutable objects......?
Immutable objects are instance whose state does not change after it has been initialized.
For example, one of our favourite class String is also immutable, that's why once it's instantiated its value never changed.
And all other wrapper classes(Integer, Boolean, Byte, Short) all are Immutable class.
There is some following way, by using that we can also make our own Immutable class.
- Declare the class as final so it can't be extended.
- Make all fields private so that direct access is not allowed.
- Don't provide setter methods for the variables.
- Make all Mutable fields final, so that its values can be assigned only once.
- Initialize all the fields via constructor performing deep copy.
- Performing cloning of objects in the getter methods to return a copy rather than returning the actual object reference.
It's really a piece of new information to me, I learn more from this blog, I want to learn more from this blog, keep on it doing, I eagerly waiting for your updates, thank you!!
ReplyDeletejava training institute in delhi
good to see your optimistic thought on this.
DeleteThanks a bunch.
I feel very grateful that I read this. It is very helpful and very informative and I really learned a lot from it. Further More Information About JAVA Training Institute in Delhi So Contact Here-+91-9311002620 Or Visit Website- https://htsindia.com/java-training-courses
ReplyDeleteits pleasure to serve all the users a good quality content, i'll be continue.....
DeleteThanks for loving the content.
ReplyDeleteJust imagine, what if you asked to write a Java assignment, but you don't know how to do it? Well, don't worry because you can Buy Assignment Writing Services online like many other students do.
ReplyDeleteJava is one of the mostly widely used programming language in enterprise software development. I appreciate your efforts in writing these educational blogs, thank you for sharing this. Best Java Training Institute In Chennai With Placement
ReplyDeleteThis information is very good; I go through your every blog. They are very knowledgeable. Thanks for sharing this information. If anyone want to get experience in Gurgaon can contact me at - 9599119376 or can visit our website at
ReplyDeleteExperience Certificate In Gurgaon
Experience Certificate In Delhi
Experience Certificate In Noida
Thank you for sharing this valuable information with us. Keep writing this type of the knowledgeable blogs. If anyone is interested for taking experience certificate in Delhi.
Dreamsoft is the 20years old consultancy providing experience certificate in Delhi for your experience certificate in Delhi you can contact at – 9599119376 or visit our website at https://experiencecertificates.com/experience-certificate-provider-in-delhi.html