I can't actually see how Java manages the object's references passing. I expose this situation to tell my doubt.
public class Clase {
public void metodo (int i, Integer objeto) {
i++;
objeto++;
}
}
public class Main {
public static void main(String[] args) {
int i = 5;
Integer object = new Integer(8);
System.out.println(i);
System.out.println(object);
new Clase().metodo(i, object);
System.out.println(i);
System.out.println(object);
}
}
All I'm getting printed is:
5
8
5
8
So, as long as I'm receiving in the method a primitive and an object, shouldn't the object be changing from the method too?