how to swap to variables without using thrid variable in java?
Answers were Sorted based on User's Feedback
Answer / 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 |
Answer / hemant verma
a=a^b^(b=a);
Hemant Verma
FameofLight@gmail.com
| Is This Answer Correct ? | 2 Yes | 0 No |
Answer / mani
int x = 15;
int y = 20;
System.out.println(x+" "+y);
x ^= y;
y ^= x;
x ^= y;
System.out.println(x+" "+y);
| Is This Answer Correct ? | 2 Yes | 1 No |
How is exception handling carried out in c++?
what is the virtual function overhead, and what is it used for ? i hope i can get and appropriate answers, thanks a lot....
Describe the difference between a Thread and a Process?
What is the types of inheritance?
What is a class oop?
Please send ford technologies placement paper 2 my mail id
Why is static class not inherited?
char* ptr = "Rahul"; *ptr++; printf("%s",ptr); What will be the output
Explain the advantages of inheritance.
what is a class
What are the 3 principles of oop?
What is difference between data abstraction and encapsulation?