How to create an Immutable class in Java? #shorts #ytshorts #java #interview

preview_player
Показать описание
DAY-8: Lets discuss How to create an Immutable class in Java?.
▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬
Spring Framework: Yet to come, subscribe till then :)
▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬
Download the code from GitHub Repository:
▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬
▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬
Subscribe to our channel and press the bell icon to get regular updates:
▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬
📌 Social Media
▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬
Copyright © 2024 ScaleUp India - All Rights Reserved

scaleup india,abhishek verma,java programming,java interview questions,java interview questions and answers,java interview,core java interview questions,core java interview questions and answers,java 8 interview questions,core java interview,java mock interview for freshers,java,java technical interview,java,java,shorts,programming,how to create custom immutable class in java,immutable class in java,how to create immutable class in java,java immutable class,create immutable class in java,immutable class,create immutable class,custom immutable class in java,how to make java class immutable,how to create our own immutable class in java,immutable class design pattern,immutable class in java interview questions,immutable classes in java,immutable object
Рекомендации по теме
Комментарии
Автор

I think, To have fields as mutable we can't define them as final and also need setter method because through constructor only once they will get assigned value but to change them further we need setter method. This breaks class being immutable class. Please let us know the answer?. Thanks.

smarttrupti