โ Back to Methods
Question 368
Swap With Ref Method
Swap With Ref Method
Write thevoidstatic methodSwapusing tworef intparameters so it exchanges the values of the two variables passed to it. The tester swapsxandy, then prints them separated by a space. Do NOT write aMainmethod. Starting fromx = 3andy = 8, afterSwap(ref x, ref y)the program prints exactly: 8 3
Expected Output:
8 3
Topics:
Methods
Code Editor
1
Tab to indent ยท Ctrl+Enter to run ยท Ctrl+Space to expand shortcuts (cw, cr, fori)
Your Output
Run your code to see the output here...
Test Cases
Run your code to see test case results.