I read this comment here: Passing a String by Reference in Java?
Yes, it's a misconception. It's a huge, widespread misconception. It leads to an interview question I hate: ("how does Java pass arguments"). I hate it because roughly half of the interviewers actually seem to want the wrong answer ("primitives by value, objects by reference"). The right answer takes longer to give, and seems to confuse some of them. And they won't be convinced: I swear I flunked a tech screen because the CSMajor-type screener had heard the misconception in college and believed it as gospel. Feh. – CPerkins Aug 13 '09 at 14:34
Can someone please explain, in terms that a new programmer can grasp, what is the difference between saying:
"In Java primitives are passed by value and objects are passed by reference."
and:
"In Java nothing is passed by reference and references are passed by value."?
Are both of these statements true in some sense? I don't want to invite a rant parade, but this sounds like a really important concept, and one I still do not completely understand.