in the Java array

Asked 2 years ago, Updated 2 years ago, 30 views

For example, int []a={1,2,3,4,5,5}; ->?->int []a={1,2,4,5,5}; to make it a The third value is Is there a way to erase it? In that case, the size of the array can be assigned dynamically or I wonder if I need to reset the array itself.

java

2022-09-22 12:24

1 Answers

An array is a static data space. It's fixed. And unlike languages like c/c++, it's created in Heap, which is a gc target. I could use the stack enough.

Because it's fixed, of course it doesn't have this dynamic property. In that case, you can use ArrayList.


2022-09-22 12:24

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.