How to swap two numbers without using temporary variables in java

Previous
Next

In this post, we will see how to swap two numbers without using temporary variables.
There are three ways to do it.
Java program:

When you run above program, you will get following output:

Third way is fastest of all.
Please go through Interview programs in java  for more such programs.

Previous
Next

Add Comment