Computer Applications
Write a method which is used to swap the values of two memory locations without using a third variable.
User Defined Methods
38 Likes
Answer
void swap(int a, int b) {
a = a + b;
b = a - b;
a = a - b;
System.out.println("a = " + a + "\t" + "b = " + b);
}
Answered By
25 Likes