سلام
چنین امکانی در جاوا نیست عین مطلب از سایت جاوا
http://www.javacamp.org/javavscsharp/outparam.html
Java doesn't have out parameters.
You can achieve C#'s functionality by wrapping a primitive
to a class, or using an array to hold multiple returned values,
and then call back that value via pass by reference.
class Test {
static void divide(int a, int b, int result, int remainder) {
result = a / b;
remainder = a % b;
System.out.println(a +"/"+ b + " = "+ result +
" r " + remainder);
}
public static void main(String[] args) {
for (int i = 1; i < 10; i++)
for (int j = 1; j < 10; j++) {
int ans = 0, r = 0;
divide(i, j, ans, r);
}
}
}