Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Agile forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

swap()

 
shree vijay
Ranch Hand
Posts: 208
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Is there any equivalent to swap(i,j) in Java?
Thanks,
Shree
 
Stephanie Grasson
Ranch Hand
Posts: 347
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Shree,
To swap values within a function, use single-element arrays. See example below:


Hope this helps.
Stephanie
 
Stephanie Grasson
Ranch Hand
Posts: 347
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Shree,
To swap values within a function, use single-element arrays. See example below:


Hope this helps.
Stephanie
 
shree vijay
Ranch Hand
Posts: 208
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Stephanie,
I was curious to know if there was any method equivalent for swap... Just plain lasy ...
Shree
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic