69 759
Assignments Done
Successfully Done
In February 2019

Answer to Question #72899 in Java | JSP | JSF for Atif Haroon

Question #72899
4. Write a program in Java to swap two numbers without using third variable.
For example if
a=5, and b=4 then after calling following function
Swap (int a, int b)
a=4 and b=5.
Expert's answer
public class Swap {
public static void main(String[] args) {
int a = 4;
int b = 5;
swap(a, b);

public static void swap(int a, int b) {
System.out.println("a="+a+" and b="+b);


Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!


No comments. Be first!

Leave a comment

Ask Your question

Privacy policy Terms and Conditions