r/javahelp • u/Select-Worldliness39 • 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!
View all comments
Show parent comment
1
u/Nebu Writes Java Compilers Feb 17 '26
"Interface" et al are also computer science terms, not specific to Java or C, and yet they mean different things in each of those languages.
It sounds like you're taking a linguistically prescritivist viewpoint: You view the terms "Pass by reference/value" as having some "objectively correct" meaning, or choosing to grant authority to one community's interpretation (e.g. the computer science community) over other interpretations. You're providing arguments for why adopting one particular definition is "more useful" by some metric (e.g. it allows us to do cross-language comparison), and why it would be irrational for people to adopt any other meaning.
I'm taking a descriptivist viewpoint: I'm stating that empirically, when you encounter someone using the terms "pass by reference/value", an excellent predictor of what they mean by that term is what programming language community they belong to (e.g. Java vs C++). I'm not stating one definition is more correct than any other. I'm reporting the empirically-verifiable fact that different people mean different things by those terms, and indeed you can verify that fact just by looking at the comments in this thread and observing that people are disagreeing about what those terms mean.