What is output? public static void swap(int val1, int val2)…
What is output? public static void swap(int val1, int val2) { int temp; System.out.print(“Before: ” + val1 + ” ” + val2); temp = val1; val1 = val2; val2 = temp; System.out.print(“- After: ” + val1 + ” ” + val2);} public static void main(String[] args) { int x; int y; x = 10; y = 20; swap(x, y); System.out.print(“- Back in Main: ” + x + ” ” + y); }
Read Details