I'm a begier to Java and have read up on how Java is pass-by-value.
From my understanding, the value of the parameter is passed into a function, not the parameter itself.
I also know that, in the case of objects, Java does not take objects as parameters. Only pointers to the object in question. So therefore, "passing an object" into a function will in fact modify that object, because even though the value of the pointer pointing to that object does not affect the original pointer, the object that both pointers point to is the same. So in essence, it's kinda like passing by reference, even though it's technically passing by value.
Is what I've said correct?
Additionally, why are Strings the exception to this rule? Is it because they are immutable, and therefore, passing a String into a function (and modifying it) means that the copy of the pointer pointing to that String will then point to the new String, while the ORIGINAL pointer to that String still points to the original string and thus stays unchanged?
Like I said, I'm very new to Java, and I'm trying to wrap my head around this concept. Are my trains of thought correct?
