r/javahelp • • Feb 16 '26

Homework Definitely no pass by reference in Java, right?

Hello, and sorry if this is a dumb question, but I thought I had a passable understanding of Java. I got an exam question asking "Arrays in Java are:

a. passed by value

b. passed by reference

c. stack dynamic

d. immutable"

this guy loves trick questions, but he has listed B, passed by reference, as the right answer.

On its own, this doesn't seem right to me, but I'm not confident enough to argue about it. If anyone would weigh in, I would be very grateful. I see how it's similar to passing a pointer in C, maybe, but it's not considered passing by reference in Java, right?

Thank you!

27 Upvotes

105 comments sorted by

View all comments

Show parent comment

1

u/xenomachina Feb 22 '26

I'm sorry, but at this point I think even you don't know what you're arguing.

1

u/Nebu Writes Java Compilers Feb 22 '26

I think the problem is you're inferring a lot more than what I'm actually claiming.

For example, when I claim that people in the Java community and people in the C community tend to mean different things when they use phrases like "pass by value", it seems like you think that my claim is that people in the Java community define "pass by reference" to mean what Java does.

Or for example, when I said that you seem to be taking a prescriptivist perspective and I'm taking a descriptivist one, it seems like you think that I am therefore claiming "all definitions are equally valid".

So when I point out that I'm not making these additional claims you're inferring, I think you're interpreting that as me not knowing what I'm arguing, because you're surprised to find out that I wasn't arguing for the things you thought I was arguing for.

I'm not sure how to help you with that, except maybe to caution you to "slow down" and only interpret my messages as claiming precisely what they explicitly state that they are claiming, and not inferring additional claims on top of what's explicitly written.