Re:Java is pass-by-value, Dammit (and so are Ruby and Python...
by dkarl on Sunday December 06, 2009 @08:10PM
(#980463)
Yes. Practical programming books usually don't talk about "pass by reference" or "pass by value" anymore, because (as people have pointed out) it's rarely a useful distinction these days, and the correct usage just confuses people because people take pass by value for granted. (C++ programmers basically see references as restricted, syntactically sweetened pointers that are passed by value. And that's almost always good enough.)
I use this as an interview question, too ("Is Java a pass-by-reference or pass-by-value language?") Nobody ever gets it, but I let people choose one of several languages to be quizzed about, and the ones who know this kind of terminology are usually game to pick a more difficult language. I don't hold it against them as long as their explanation of why Java is pass by reference shows a correct understanding of Java parameter passing. But I always set them straight afterwards ;-)
I use this as an interview question, too ("Is Java a pass-by-reference or pass-by-value language?") Nobody ever gets it, but I let people choose one of several languages to be quizzed about, and the ones who know this kind of terminology are usually game to pick a more difficult language. I don't hold it against them as long as their explanation of why Java is pass by reference shows a correct understanding of Java parameter passing. But I always set them straight afterwards ;-)