Java
Myclass obj1=new Myclass();
Myclass obj2=null;
obj2=obj1;
obj1.Name="abc"; //"abc" will also assign to obj2.Name.When I assign obj1.Name="abc", it will also assign to obj2.Name. I want to stop this. I have tried by const, sealed but I am not getting result. Can anybody suggest me how to stop reference of obj1 on obj2?

Pranay RanaRank #735 · 3.2K reputationPosted Jul 23, 2015, 10:45 PM EDT
Guest UserRank #816 · 2.8K reputationPosted Jul 23, 2015, 10:47 PM EDT
Myclass obj1 = new Myclass(); Myclass obj2 = new Myclass();obj1.Name="abc";