List<double[]> x = new ArrayList<double[]>();
x.add(new double[]={1,2,3,4,54,6});
elements 1,2,3,4,54,6 are added to x
x.get(0) ---> returns 1
But doing this, address of array is added? why
List<double[]> x = new ArrayList<double[]>();
double[] name=new double[5];
name[0]=1
name[1]=3;
name[2]=3;
.
.
.
.
x.add(name);
getting x.get(0) ---> returns @as12cd2 (address of the array)
double
elements rather thandouble[]
as it should. This is straight-up odd, and might lead to errors, asget(...)
is expected to returndouble[]
at compile time but returnsdouble
at runtime.