Pass by Value | Pass by Reference |
In this a copy of the variable is passed to the method the values of the variable cant be changed in the method. | Here the pointer of the variable is passed and the values can be modified in the method. |
While passing an argument to a method java creates a copy of the values inside the original variable and pass that to the method as arguments – and that is why it is called pass by value. | A value is passed by reference because a copy of the reference value is created and passed into the other object. |
Everything is mostly passed by value. | Most of the variables in java are never passed by reference. |