Tuesday, November 29, 2011

How can I swap two variables without using a third variable?Can u plz tell me the logic behind it..?

Add two variables and assign the value into First Variable.Subtract the Second value with the Resul Value. and assign to Second Variable.Subtract the Result of First Variable With Result of Second Variable and Assign to First Variable.EX:Int a=5,b=10;a=a+b; b=a-b; a=a-b; :br
Category:Java Interview Questions

No comments:

Post a Comment