Re: Passing Primitive Types "By Reference" In Java

  • From: Jared Stofflett <stofflet@xxxxxxx>
  • To: programmingblind@xxxxxxxxxxxxx
  • Date: Mon, 04 Feb 2008 00:21:11 -0500

There's no really good way to do this. You could either use the java rapper classes like java.lang.integer or an array. FOr an example of an array see this link

http://www.javacoffeebreak.com/faq/faq0066.html
why do you want to pass a primitave by refference, there's usually not a good reason to do this and it just makes your code complex.
Jared Wright wrote:
Hi Folks, I am familiar with Java's passing all parameters to methods strictly by value. I am also familiar with how it always uses references to indicate objects, and so passing objects by reference is easily accomplished from a practical standpoint--the values of the references are actually passed, but the end result is much the same. I'm unsure though as to what would be the most effective way of passing a primitive type to a method in such a way that the method can modify the original variable. Thanks in advance for any thoughts.

Jared
__________
View the list's information and change your settings at //www.freelists.org/list/programmingblind




__________
View the list's information and change your settings at //www.freelists.org/list/programmingblind

Other related posts: