In C++, if you need to have 2 objects modified, you can pass by reference. How do you accomplish this in java? Assume the 2 objects are primitive types such as int.
Using generics you can create a pointer class which would make this at least somewhat less painful. You pass in the object, change it's value property and when the function exits your object will contain the new value.
MyPointerClass PointerClass = new MyPointerClass(5);
myFunction(PointerClass);
System.out.println(PointerClass.Value.toString());
// ...
void myFunction(myPointerClass SomeValue)
{
SomeValue.Value = 10;
}