+ 1
How can I make this working for swapping value in JAVA?
3 Respuestas
+ 2
You did not declare a temporary variable to store num1 value or num2 and finally assign this value to num2 or num2 but in the middle set num1 = num2 ;
+ 1
You did not declare a temporary variable to store num1 value or num2 and finally assign this value to num2 or num2 but in the middle set num1 = num2 ;
I have to do it without declaration of a temporary variable i.e. in another way.
+ 1
You can use bitwise xor operator here then. num1 = num^num2^(num1= num2)