While Rui's answer is fine, I believe some of it is incorrect. It makes no sense (extremely inconsistent) for an array that will be allocated from the stack memory and then accessible by reference. If that were the case, the underlying memory could be freed from any methods to which the link was sent.
I believe that Henk Holterman correctly described this when he said very bluntly and unequivocally:
Arrays are reference types, which means that the actual array created on the heap
Thanks to Henk for this comment; I think this is a critical part, otherwise there is no (and contradicts) the accepted answer.
(I would respond to the comment, but I do not have enough answers, and I think it is important enough to indicate that the accepted answer has this problem for me to add a new comment here.) Perhaps the administrator can remove the link to "local variable, it will live on the stack from the answer.
source share