The Java Spec says that everything in Java is pass-by-value. There is no such thing as "pass-by-reference" in Java.
The difficult thing can be to understand that Java passes "objects as references" passed by value.
This can certainly get confusing and I would recommend reading this article from an expert: http://javadude.com/articles/passbyvalue.htm Also read this interesting thread with example on StackOverflow : Java Pass By Ref or Value
No comments:
Post a Comment