I'm developing an java application and now I noted an a strange behaviour that confused me. I have the following situation:
Integer currentIndex = 0;
doSomethings(currentIndex);
System.out.println("Print "+currentIndex);
private void doSomethings(Integer currentIndex){
//Do other things and update my current index
currentIndex++;
}
but I get always 0 like value. I remember that the objects are passed like reference in java, while the primitive types like copy. Why Do I get 0 in this case?