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 |
Program to check whether a word is the first word of the sentence.
WHAT IS ABSTRUCT DATA TYPE ? PLEASE EXPLAIN IT.
What is virtual constructors/destructors?
Which is faster post increment or pre increment ? and in which cases should u use either - to increase speed?
Why do we need polymorphism in c#?
Name an advantage of array over linked list?
24 Answers GML, IBM, Software Solutions,
explain the concepts of oops?
Why do we use polymorphism in oops?
why we are declare the function in the abstract class even though we are declaring it in Derived class?
How is class defined?
What is meant by oops concept?
c++ is a pure object oriented programming or not?