My sample code -
private final DataObj dataObj = getDataObjs();
private final DataObj dataObj1 = new DataObjImpl();
dataObj1 = dataObj; //I need the value of dataObj1 to be the same even if the value of dataObj is modified anywhere further down in a class.
My problem is that if the value of the Object dataObj
is being modified then the value of the second Object dataObj1
is also modified but I need the second Object dataObj1
to be immutable (Value should persist), is there a way to do this?