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
Why is oop better than procedural?
What is polymorphism used for?
What is the oops and benefits of oops programming?
What is overloading and its types?
Why it is called runtime polymorphism?
What is class in oop with example?
assume the program must insert 4 elements from the key board and then do the following programs.sequential search(search one of the elements),using insertion sort(sort the element) and using selection sort(sort the element).
Get me a number puzzle game-program
What is encapsulation with real life example?
What is an example of genetic polymorphism?
What is difference between pop and oop?
What is polymorphism in oop example?
What is debug class?what is trace class? What differences are between them? With examples.
Write a java applet that computes and displays the squares of values between 25 and 1 inclusive and displays them in a TextArea box
They started with the brief introduction followed by few basic C++ questions on polumorphism, inheritance and then virtual functions. What is polymorphims? How you will access polymorphic functions in C? How virtual function mechanism works?