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

Join Our News Letter – Stay Updated

Subscribe to Awesome Java Content.




Add Comment

Join Our News Letter - Stay Updated

Subscribe to Awesome Java Content.
You can like our facebook page Java2blog