Categories
interview

Java Objects, Arrays – Pass by Reference?

The array reference here is passed by value to the methods below. This is similar to what we usually see in case of Javascript.

Arrays

Objects

The following program to print kth last element in a linkedlist, demonstrates that value of method parameters always take values only. In the case of objects, the value (a copy) of the object reference is passed.