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;

Download Java Software Engineer PDF Read All 45 Java Software Engineer Questions
Previous QuestionNext Question
Tell us what are checked and unchecked exceptions? When do you use them?Tell us what are constructors in Java?