If you pass a primitive to a method, you don't get a reference to that primitive; you can't change it in that method. Pass by value.
If you pass an object reference, including an array, to a method, then the reference value is copied. Pass by value. Since the copied reference value is the same as the reference value that it was copied from, you can modify the state of the referenced object, but you can't alter the original reference in the method.
Get it right: you can modify the referenced object's state, but you can't modify the reference itself.
This is not because of magic elfs that defend the reference with life and limb. This is because Java is pass by value."
I have read your blog its very attractive and impressive. I like it your blog.ReplyDelete
Java Training in Chennai Java Training in Chennai | Core Java Training in Chennai | Java Training Institutes
Online Java Training Java Online Training | Java J2EE Online Training | JavaEE Training Institute in Chennai