Java is pass by value only. There is a misconception that for passing objects we use pass by reference in Java, but it is nothing but only a myth.
Now what is pass by value & pass by reference?
As you might be knowing, programming works by creating new address blocks for parameters and storing them at different locations, when we have to use that stored variable later we may pass that variable without defining it again, so for this purpose we may use pass by value and pass by reference.
In pass by value, the ‘passed’ variable gets copied to a different location and therefore if we make changes in it, those changes get modified in the newly copied variable only and not in the older one that was stored previously. So we can access that old variable by calling the older address and the new (or modified) parameter at the new address. While, in case of pass by reference, the original variable gets replaced after getting modified and the older value is not accessible as it gets overwritten by the new one.
Hope this helps you.