Thursday, January 31, 2019

JAVA - How to solve REF/OUT method parameters

JAVA doesn`t support REF/OUT method parameters (=parameters that could be changed in method to another value).

But you can define class instance, which can be passed and used as REF:

1) Prepare this help class with one int variable:
public class ParamWrapperInt {
  public int value;
}
2) Use it:
private boolean methodName( ParamWrapperInt _maxMinorDimension ) {
  ...
  /* work with int */
  _maxMinorDimension.value = ...
  ...
  return true;
}

No comments:

Post a Comment