CodePudding user response:
Java method parameters only value transfer, there is no pointer and a reference type, so use method direct exchange of two variables is can't do,If use indirect way, you can use array, collection, or the two variables are encapsulated into a class or interface