Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

5
  • 5
    JVMS 2.2 makes this pretty clear: There are ... two kinds of values that can be stored in variables, passed as arguments, returned by methods, and operated upon: primitive values and reference values." Object references are values. Everything is passed by value. Commented Nov 1, 2020 at 15:52
  • geeksforgeeks.org/g-fact-31-java-is-strictly-pass-by-value Commented Mar 2, 2021 at 7:28
  • The operative implication: f(x) (passing a variable) will never assign to x itself. There is no such thing as a variable address (alias) passed. A solid language design decision. Commented Sep 20, 2021 at 9:37
  • So basically we're passing the address and we reference that address in our method for example in c int test(int *a) { int b = *(a); return b;) ? Commented Feb 7, 2022 at 17:31
  • So, when I want to pass an object to some method, I'm doomed, because an object is "not a value" :( Commented Feb 16, 2022 at 15:34