Complete the test by value program (see Listing 6.5) on page 213 of the textbook. Your output should look like that on page 213 of
Complete the test by value program (see Listing 6.5) on page 213 of the textbook. Your output should look like that on page 213 of the textbook (see below). Before invoking the swap method, num1 is 1 and num2 is 2 Inside the swap method Before swapping n1 is 1 n2 is 2 After swapping n1 is 2 n2 is 1 After invoking the swap method, num1 is 1 and num2 is 2 Next, modify the main method so after the call to the swap method the actual values of num1 and num2 are swapped in main and show this in the output. Your output will have one additional line after the listing on page 213 that shows the values of the two numbers in main after they are swapped. See new output line below in blue text. Before invoking the swap method, num1 is 1 and num2 is 2 Inside the swap method Before swapping n1 is 1 n2 is 2 After swapping n1 is 2 n2 is 1 After invoking the swap method, num1 is 1 and num2 is 2 After swapping the numbers in main method, num1 is 2 and num2 is 1.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started