|
itsasnake posted:Okay so very basic coding question here but even after googling and harassing quite a number of people i can't seem to find out how. Lazy way: code:
|
# ¿ Mar 14, 2008 03:00 |
|
|
# ¿ Apr 28, 2024 17:53 |
|
Entheogen posted:One important thing to remember about java is that all variables are references, unless its an atomic type like int, or float. Because of this if you say array_1 = array_2, array_1 is not merely a copy or a clone of array_2. if you make changes to array_1 they will appear when you reference elements from array_2 because both store reference to the same object in memory. Not exactly - all variables are passed by value, but in the case of non-primitives the value happens to be an internal pointer to an object instance. It's a subtle but important distinction that makes it possible to reassign a variable within a different scope without affecting the object reference outside of said scope.
|
# ¿ Jul 5, 2008 00:54 |