3 ms·
In the 3rd question, if you give the wrong answer, it says Java is pass-by-reference as well, though IIRC it is always pass-by-value. Also JS passes primitives
by chris54721 9y ago
In the 3rd question, if you give the wrong answer, it says Java is pass-by-reference as well, though IIRC it is always pass-by-value. Also JS passes primitives by val as well if I'm not mistaken.
- ammon 9y agoWell, objects in Java are only accessible via references. So the result is behavior identical to Python and JS (primitives are passed by value, objects are passed by reference)
- Tharkun 9y agoJava is indeed pass-by-value, but it behaves like pass-by-reference when dealing with objects/arrays (because object references are passed by value).