r/code • u/sumitskj • 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
View all comments
Show parent comment
2
u/sumitskj Jan 30 '25
so is java both pass by value and pass by reference. but I have read a lot in docs that it is always pass by value