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 can i write a code in c# to take a number from the user and then find all the prime numbers till the number entered by the user.
What is polymorphism and its types?
What are the advantages of inheritance?
26 Answers IBS, TCS,
what is the difference between class and object?
How to create a comment page in C #??
What do you mean by pure virtual functions?
What are two types of polymorphism?
What is the renewal class?
What are the 4 pillars of oop?
How do you achieve runtime polymorphism?
what is the main difference between sizeof() operator in c and c++
Can you explain polymorphism?