Int[] a = {1,2,3,4}; int[] b = {2,3,4}; a=b; Now the array a is pointing to array b, how to access the original array a? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Int[] a = {1,2,3,4}; int[] b = {2,3,4}; a=b; Now the array a is pointing to array b, how to access the original array a?

14th May 2021, 1:40 PM
Harshanand Raykar
Harshanand Raykar - avatar
3 Answers
+ 2
it's lost. Make a temporary array and before a=b, assign it to the temporary array. Did i got what you meant??
14th May 2021, 1:42 PM
Rohit
+ 2
Harshanand Raykar Store the array a in any other variable for future reference
14th May 2021, 3:44 PM
Atul [Inactive]
0
too late, it is already in the hands of the garbage collector 🤣
14th May 2021, 1:50 PM
Ciro Pellegrino
Ciro Pellegrino - avatar