String var_a = null;
String var_b = null;
Xyz obj1 = new Xyz();
Abc obj2 = new Abc();
if(var_a != null){
obj1.setValue1(var_a);
}
if(var_b != null){
obj1.setvalue2(var_b);
}
if(obj1 != null ){
obj2.setvalue(obj1);
}
In this case there is only 2 values but i may have 30 values to set on obj1.Problem is when i Initialize obj1 it assigns null to all its value and when i check if obj1 != null it reads obj1 as not null because by default value is assigned to them. I need something which can set obj1 value null not its reference but its value or something which can check all the value of obj1 if all are null and if any value is not null to it can be set on obj2. Thanks in advance
obj1
is null, and then assign a value to those properties?