wood burning stoves 2.0*
The moose likes Beginning Java and the fly likes swap() Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "swap()" Watch "swap()" New topic
Author

swap()

shree vijay
Ranch Hand

Joined: Sep 18, 2000
Posts: 208
Hi,
Is there any equivalent to swap(i,j) in Java?
Thanks,
Shree

Regards,<BR>Shree
Stephanie Grasson
Ranch Hand

Joined: Jun 14, 2000
Posts: 347
Shree,
To swap values within a function, use single-element arrays. See example below:


Hope this helps.
Stephanie
Stephanie Grasson
Ranch Hand

Joined: Jun 14, 2000
Posts: 347
Shree,
To swap values within a function, use single-element arrays. See example below:


Hope this helps.
Stephanie
shree vijay
Ranch Hand

Joined: Sep 18, 2000
Posts: 208
Thanks Stephanie,
I was curious to know if there was any method equivalent for swap... Just plain lasy ...
Shree
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: swap()