Therefore: Pass the parameter wrapped in an array:
void addOne (int[] arg) { arg [0] = arg [0] + 1; }However: This smells funny, so see AlternativesToPassByReference...
int a[] = new int [1] {2}; addOne (a); System.out.println (a [0] );
3
See also: PassParameterInWrapperObject
This page mirrored in JavaIdioms as of April 29, 2006