Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

how to swap to variables without using thrid variable in java?

Answer Posted / 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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the difference between inheritance and polymorphism?

1123


Which is better struts or spring?

1066


what is different between oops and c++

2557


What are main features of oop?

1126


How do you achieve polymorphism?

1089


What is encapsulation process?

1058


which feature are not hold visual basic of oop?

2200


What is overriding in oop?

1050


Can private class be inherited?

1176


What is polymorphism explain?

1268


Why is encapsulation used?

1003


What is property in oops?

1073


What do you mean by variable?

1047


write a program to find 2^n+1 ?

2079


What is meant by oops concept?

1052