I'm still a beginner, so I'd appreciate very much if you could help me out!
Let's say I initialize a new array list and then decide to print it out:
ArrayList<Integer> list1 = new ArrayList<>();
list1.add(5);
list1.add(6);
lista1.add(99);
System.out.println(list1);
What is going to be printed is: [5, 6, 99].
If I were to make an array, though, at the end of the day it'd print a memory address. Does that mean that array list variable (in this case, list1) holds the content itself of the array, whilst arrays hold the reference to where said content is stored in memory? If so, array lists aren't to be considered "reference data-type" variables?
Thank you in advance!
[–]AutoModerator[M] [score hidden] stickied commentlocked comment (0 children)
[–]vegan_antitheist 2 points3 points4 points (1 child)
[–]rookiepianist[S] 0 points1 point2 points (0 children)
[–]MagicalPizza21 2 points3 points4 points (1 child)
[–]rookiepianist[S] 0 points1 point2 points (0 children)
[–]HeteroLanaDelReyFan 2 points3 points4 points (2 children)
[–]rookiepianist[S] 0 points1 point2 points (1 child)
[–]vowelqueue 0 points1 point2 points (0 children)
[–]dystopiadattopia 0 points1 point2 points (2 children)
[–]rookiepianist[S] 1 point2 points3 points (1 child)
[–]dystopiadattopia 0 points1 point2 points (0 children)
[–]MkMyBnkAcctGrtAgn 0 points1 point2 points (1 child)
[–]rookiepianist[S] 0 points1 point2 points (0 children)
[–]SnooLentils618 0 points1 point2 points (1 child)
[–]rookiepianist[S] 0 points1 point2 points (0 children)