public class Main{
.
.
.
Class class = new Class();
class.method(class.variableFromAnotherClass);
sysout(class.variableFromAnotherClass)
}
public class Class{
Int variableFromAnotherClass=0;
method(int var){
var=1;
}
}
Output:
0
Im dealing with a situation similar to the one above except with more variables in my version of "Class". My issue is that the method within "Class" does nothing to the variable being passed through. Why does this happen? Is it because the variable being passed through already belongs to the class? Any suggestions on What should I do to solve this problem?