In general, for variables of the same type, A will not be affected even if B changes after entering B into A.
However, in case of Vector type object, if B is input to A object and B.clear () or B.removeAllElements() is executed, A is also initialized to null value.
Please explain why this is happening Also, how can I disconnect shared objects of vector objects A and B?
public class test {
public static void main(String[] args) {
int A = 1;
int B;
B = A;
A = 0;
Vector<String> goPathNode = new Vector<String>();
Vector<String> tempGoPath = new Vector<String>();
tempGoPath.add("A");
tempGoPath.add("B");
tempGoPath.add("C");
//goPathNode.add("A");
//goPathNode.add("B");
//goPathNode.add("C");
goPathNode = tempGoPath;
tempGoPath.clear();
//goPathNode.removeAllElements();
}
}