Styrow.dev
Question 149 of 247
Java Topic: General medium

Does all property of immutable object needs to be final?

Question

Does all property of immutable object needs to be final?

Answer

No, it Doesn’t to make all property of immutable object final. you can write immutable object by making member as non final but private and not modifying them except in constructor.


📲 Practice Offline on Mobile: Download the free QA Automation & SDET Prep app on Google Play & App Store.