How to create immutable objects in java what is the advantage of immutable object
4,463 views · Published 4 November 2012 · 2:59 · Indexed 27 September 2026
Channel: Interview DOT · 2012 · Science & Technology
Click here - https://www.youtube.com/channel/UCd0U_xlQxdZynq09knDszXA?sub_confirmation=1 to get notifications. You can submit your resume for right Job http://www.interviewdot.com/upload-resume/uploadresume.htm http://www.interviewdot.com http://www.interviewdot.com http://www.interviewdot.com Welcome to www.InterviewDot.com Java Interview Questions and Answers : Job portal -- Java Tutorial / Interview How to create immutable objects in Java ? Immutable means: my public visible state cannot change after initialization. Make the class final. Make all members final, set them explicitly, in a static block, or in the constructor. Make all members private. No Methods that modify state. Be extremely careful to limit access to mutable member components -- use Defensive Copy. What are the advantages of immutable objects ? One of the great advantages are that immutable objects are thread safe. Why ? Because the values will never change. They are free to be read at any time by anyone and require no synchronization. They are great for reusable constants object. You can submit your resume for right Job http://www.interviewdot.com/upload-resume/uploadresume.htm For more Interview questions and answers - logon to www.InterviewDot.com -- Next Generation Job Site. http://www.interviewdot.com http://www.interviewdot.com http://www.interviewdot.com
More from this channel
-
5:51
Top 4 Job Interview Tips How to prepare for Job interview
-
2:42
what are different access modifiers core java interview questions and answers
-
0:43
Top Core Java Interview questions and answers 8
-
1:04
Top Core Java Interview Question and Answer 9
-
1:41
What happens if a java thread throws nullpointer exception interview
-
1:58
What is a java thread scheduler java interview question and answer
-
5:16
How many java static initializer we can have how it will be executed job interview
-
1:08
Top 10 Spring interview questions important spring interview questions