Write a method which is used to swap the values of two memory locations without using a third variable.
38 Likes
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
Differentiate between pure and impure methods.
Write a method which is used to swap the values of two memory locations by using a third variable.
Differentiate between call by value and call by reference.
What are the advantages of defining a method in a program?