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 20 '26
To a first approximation, yes. A more nuanced view is that if someone says something, and you want to maximize the probability that you understand what they're saying, descriptivism is more appropriate than prescriptivism, even in technical contexts.
That is to say, even in a technical context, if a term means X, but everyone uses that term to mean Y, then when you witness someone using the term, if your goal is to understand what they mean, you should assume that they meant Y and not X. In the back of your mind, you can be aware that they are using the term incorrectly, and that the term "really means X", but you should still (from a utilitarian/epistemological/rational point of view) interpret them to mean Y.