how to swap 2 eleements ona arrayin java code example Example: java switch two items in an array String temp = arr[1]; arr[1] = arr[2]; arr[2] = temp;