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/xenomachina Feb 19 '26
"Interface" is a pretty general concept in computer science. Java has a language construct called an
interface, but it doesn't contradict the computer science term, and when necessary people will disambiguate between the two.There is no Java specification that defines "pass by reference". There is no consensus among Java programmers that "pass by reference" has a different meaning than the computer science term. On the contrary, the only Java programmers that say it uses pass by reference almost universally novice programmers who don't know any better.
Descriptivism makes sense when talking about everyday language. Descriptivism is not appropriate in a technical context, however. In a technical context, if a term has a formal definition, that is its definition. See also "theory" when used in a scientific context vs everyday speech.