How do I use an equivalent to C++ reference parameters in Java?

后端 未结 11 1271
借酒劲吻你
借酒劲吻你 2020-12-09 14:33

Suppose I have this in C++:

void test(int &i, int &j)
{
    ++i;
    ++j;
}

The values are altered inside the function and then use

11条回答
  •  醉梦人生
    2020-12-09 14:48

    The easiest solution is to use org.apache.commons.lang.mutable.MutableInt class you don't need to write by yourself.

提交回复
热议问题