Why doesn’t my java exchange function work?
•
Java
See English answer > is java "pass by reference" or "pass by value"? 78
void swap(int a,int b) { int temp = a; a = b; b = temp; }
Solution
Your swap only copies the values into a and B, so you only need to swap the values in the A and B variables within the swap range
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码