Java Arrays - each element in the array holds a pointer to the next element

The LinkedList Java class uses a doubly linked list to store items.

Does arrays in Java use a sibling list?

Is this how the array and stacks are different in java.

+4
source share
3 answers

No. An array is just a contiguous block of memory whose length can be checked to make sure that you are not trying to access elements outside the bounds of the array.

To go to a specific element, the virtual machine simply (logically, at least) takes the starting address of the data in the array and adds the index times the element size.

+7

STACK LIFO. , , , .

. . .

+1

Arrays are completely different from linked lists. When it comes to a linked list, the difficulty of removing an item from a list is lower than the cost to remove an item from arrays.

0
source

Source: https://habr.com/ru/post/1627555/


All Articles