Steve Higgins

Greenhorn
+ Follow
since Apr 26, 2011
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Steve Higgins

me too. i think i need a visual drawing of wth is goign on.
thanks for the help guys but i still don't see the diff btwn for loop and arraycopy(). i mean is there soemthing that can go wrong if i use for loop vs arraycopy()?

after a for loop executes an array copy, is array1 still pointing to array1 and array2 still pointing to array2?
after arraycopy() executes an array copy, is array1 still pointing to array1 and array2 still pointing to array2?

i guess i am trying to find a difference soemwhere that i can comprehend.
12 years ago
hi and ty for the reply. i guess i am still a bit confused.
if i code array1=array2 i understand that this is a shallow copy taking place too; or am i wrong?
but then when i change a value in array1, array2 is changed as well. but with arraycopy() this is not the case, but they are both shallow copy methods???

i guess this whole distinction between shallow and deep and what is really going on does not make sense to me.
i do appreciate your response though friend and ty again.
12 years ago
hi guys i have read everywhere that this method is shallow but when i go to test it and change a value in one of the arrays, the other one is unaffected.
im really confused... maybe i'm confusing the terminology. i was taught to use a for loop to copy values, but i dont why not take advantage of System.arraycopy()?



output is:
12 years ago