Write a Java code to swap two numbers without using a temporary variable.

AnswerBot
1y
Swapping two numbers without using a temporary variable in Java
Use bitwise XOR operation to swap two numbers without using a temporary variable
Example: int a = 5, b = 10; a = a ^ b; b = a ^ b; a = a ^...read more
Help your peers!
Add answer anonymously...
Popular interview questions of Technology Analyst
A Technology Analyst was asked 12mo agoQ1. Write a program using Object-Oriented Programming (OOP) in Java.
A Technology Analyst was asked 12mo agoQ2. Write a Java code to swap two numbers without using a temporary variable.
A Technology Analyst was asked 12mo agoQ3. What is circular dependency?
>
Infosys Consulting Technology Analyst Interview Questions
Stay ahead in your career. Get AmbitionBox app


Trusted by over 1.5 Crore job seekers to find their right fit company
80 L+
Reviews
10L+
Interviews
4 Cr+
Salaries
1.5 Cr+
Users
Contribute to help millions
AmbitionBox Awards
Get AmbitionBox app

