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 point of oop?
What is solid in oops?
Why is object oriented programming so hard?
What is the benefit of oop?
just right the logic of it 1--> If few people are electing then every time ur candidate should win 2--> arrange books in box, if box carry weight == books weight then take another box..... find the no of box required.
What are different types of JVM's? for example we use dalvik jvm for android then what about the remaining operating systems?
What are the three parts of a simple empty class?
What is difference between pop and oop?
Is this job good for future? can do this job post grduate student?
Advantage and disadvantage of routing in telecom sector
What is the important feature of inheritance?
What is and I oop mean?
Why do we need oop?
Whats is abstraction in oops?
Why is static class not inherited?