Home > Back-end >  Two dimensional array one dimensional array
Two dimensional array one dimensional array

Time:09-27

The elements in the two-dimensional array can be a one dimensional array?

CodePudding user response:

that want to increase machine

CodePudding user response:

A two-dimensional array is a one dimensional arrays of
You said the "elements" refers to the form, with a subscript or take two subscripts form?
Such as you define an array int [] [] XXX;
XXX [0] is actually an int [] (an int array)
XXX [0] [0] is an int

If you ask is XXX [0] can [0] or an array, then become a three-dimensional array

CodePudding user response:

refer to the second floor sunyiz response:
two-dimensional arrays is a one dimensional array
You said the "elements" refers to the form, with a subscript or take two subscripts form?
Such as you define an array int [] [] XXX;
XXX [0] is actually an int [] (an int array)
XXX [0] [0] is an int

If you ask is XXX [0] can [0] or an array, then became a three dimensional array

Is that I met the Object [] [] this two-dimensional arrays, the inside of the element is a multiple one dimensional array, I want to ask, is the only Object array can be in this way, or do any two-dimensional array can put one dimensional array element

CodePudding user response:

references a 223317 response: 3/f
is that I've met Object [] [] this two-dimensional arrays, the inside of the element is a multiple one dimensional array, I want to ask, is the only Object array can be in this way, or do any two-dimensional array can put one dimensional array elements when


Because the array itself is also an Object
So the Object can be a one-dimensional array of the elements in an array
Regardless of any other type, even if its internal structure is an array,
Such as an ArrayList, its internal also can be regarded as an array, but still can not send an array directly as the ArrayList [] [] an element

So really only Object [] [] of the elements, can be an array

CodePudding user response:

references a 223317 response: 3/f
is that I've met Object [] [] this two-dimensional arrays, the inside of the element is a multiple one dimensional array, I want to ask, is the only Object array can be in this way, or do any two-dimensional array can put one dimensional array elements when


The Serializable [] [] should also go, array is the default for the Serializable

CodePudding user response:

The
refer to the original poster a 223317 response:
2 d can be a one-dimensional array of the elements in an array?


Can be any element in the array, even if you are in the 1 d array also can save a 2 d array, think but is a 2 d array is one of the elements,
  • Related