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 |
What is a unary operator?
Write a program to get the binary tree.
suppose A is a base class and B is the derved class. Both have a method foo which is defined as a virtual method in the base class. You have a pointer of classs B and you typecast it to A. Now when you call pointer->foo, which method gets called? The next part of the question is, how does the compiler know which method to call?
how to get the oracle certification? send me the answer
What is the difference between the C & C++?
when my application exe is running nad i don't want to create another exe what should i do
Child cObj = new Parent() Wahts the output ?
What is ambiguity in inheritance?
1. Strong name 2. how to prevent a class from being inherited 3. delegates 4. default modifier for interface 5. default modifier for class 6. base class for exception 7. diff bet trigger and view in sql 8. how to exchange values from one page to another page 9. can multiple catch block ll be executed at same time 10. can u store different data types in an array & array list 11. when we ll use trigger 12. try,catch,finally usage
What is the differances between a abstract calss and interface
what is the usage of clas templates
What are the valid types of data that the main () can return in C/C++ language