← Back to Methods
Question 458
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 the output shown in Expected Output.
Expected Output:
8 3= newline. The output ends with a newline — print one after the last line.
Hints3 available
Sign in to use hintsTopics:
Methods
1
Tab to indent (Esc then Tab to move on) · Ctrl+Enter to run · Shift+Alt+F to format · 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.