Difference between pass by value and pass by reference

Difference between pass by value and pass by reference.

Pass by ValuePass 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.
What are access modifiers in JAVA?
What are access modifiers in JAVA?
Define Savepoints in a transaction
Define Savepoints in a transaction - Using Savepoint, you can mark one or more places in a transaction and you can perform rollback to one of those...
What are filter class in java?
What are filter class in java? - The filter class in java can manipulate request before reaches to the web server. It can also manipulate response before it reaches the client browser......
Post your comment