In swap method why is the same value after swapping method in main method
Answers
Answered by
13
Here's a method to swap two variables in java in just one line using bitwise XOR(^) operator. There are no pointers in Java. However, every variable that "contains" an object is a reference to that object. To have output parameters, you would have to use objects.
Similar questions
English,
6 months ago
Computer Science,
6 months ago
Computer Science,
1 year ago
English,
1 year ago
Physics,
1 year ago