It is probably a basic question, but I am not sure what keywords to use to search it.
Is it possible to assign a value to a return variable in Java, something like that:
static int a[] = new int[2];
static int f(int i) {
return a[i];
}
static void main() {
f(1) = 0; // <-- this
}
In C/C++ I can return a pointer and assign a value to it later. Since Java works with references I would expect the code above to work. Am I missing some important Java concept here?
Even if it is reference type, the method invokation is not a variable.
However, something like this would be OK: