1public static void swap(int[] a, int i, int j){
2 int temp = a[i];
3 a[i] = a[j];
4 a[j] = temp;
5}
1public class Exercise15 {
2 public static void main(String[] args) {
3 // int, double, float
4 int a, b;
5 a = 15;
6 b = 27;
7 System.out.println("Before swapping : a, b = "+a+", "+ + b);
8 a = a + b;
9 b = a - b;
10 a = a - b;
11 System.out.println("After swapping : a, b = "+a+", "+ + b);
12 }
13
14}
15
16