how to swap to variables without using thrid variable in java?
Answer Posted / igor polivanyi
It’s pretty simple:
int a = 12;
int b = 34;
a = a + b;
b = a - b;
a = a - b;
And for real cowboys, it could be simplified further:
a -= (b = (a += b) - b);
| Is This Answer Correct ? | 8 Yes | 0 No |
Post New Answer View All Answers
What is the difference between inheritance and polymorphism?
Which is better struts or spring?
what is different between oops and c++
What are main features of oop?
How do you achieve polymorphism?
What is encapsulation process?
which feature are not hold visual basic of oop?
What is overriding in oop?
Can private class be inherited?
What is polymorphism explain?
Why is encapsulation used?
What is property in oops?
What do you mean by variable?
write a program to find 2^n+1 ?
What is meant by oops concept?