Java Software Engineer Question:
Tell us how can you swap the values of two numeric variables without using any other variables?
Answer:
You can swap two values a and b without using any other variables as follows:
a = a + b;
b = a - b;
a = a - b;
a = a + b;
b = a - b;
a = a - b;
Previous Question | Next Question |
Tell us what are checked and unchecked exceptions? When do you use them? | Tell us what are constructors in Java? |