[Solved] Reassigning variable values in java [closed]


Your question isn’t clear, but I believe you are looking for a “swap” functionality:

var x = 2;
var y = 3;
var z = 0;
// your code here
z = x;  // Temporarily store x in z
x = y;  // Overwrite x with y
y = z;  // Store the original value of x in y
console.log("The value of x is: " + x + " (x should be 3)");
console.log("The value of y is: " + y + " (y should be 2)");

solved Reassigning variable values in java [closed]