Given two int variables, firstPlaceWinner and secondPlaceWinner, write some code that swaps their values. Declare any additional variables as necessary.

Given two int variables, firstPlaceWinner and secondPlaceWinner, write some code that swaps their values. Declare any additional variables as necessary.

LANGUAGE: JAVA

CHALLENGE:

Given two int variables, firstPlaceWinner and secondPlaceWinner, write some code that swaps their values. Declare any additional variables as necessary.

SOLUTION:

int temp;
temp = firstPlaceWinner;
firstPlaceWinner = secondPlaceWinner;
secondPlaceWinner = temp;

Add comment