r/code • • Jan 30 '25

Java Is java not pass by reference?

As per what I know when i pass some parameters to a function they get modified. but in docs it says java is pass by value. I am not getting it.

Also I watched this video: https://www.youtube.com/watch?v=HSPQFWEjwR8&ab_channel=SumoCode

but I am not getting it. can anyone explain

2 Upvotes

4 comments sorted by

View all comments

Show parent comment

3

u/StochasticTinkr Jan 30 '25

It passes references by value. It might sound like I’m joking, but that’s how it is.