How to swap two numbers without using temporary variable:
public class SwappingNumbers{
public static void main(String []args){
int a=10,b=20;
a=a*b;
b=a/b;
a=a/b;
System.out.println("a =
"+a);
System.out.println("b = "+b);
}
}
Output:
a = 20
b = 10
EmoticonEmoticon