Java Software Engineer Question:
Download Questions PDF

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;

Download Java Software Engineer Interview Questions And Answers PDF

Previous QuestionNext Question
Tell us what are checked and unchecked exceptions? When do you use them?Tell us what are constructors in Java?