How to resize an array?
I am trying to resize an array, but I am getting these error messages:
incompatible types
found: Shape2[]
required: java.lang.String[]
String [] original = array;
incompatible types
found: java.lang.String
required: Shape2
array = original;
What do they mean?
Here's my code:
publicstatic Shape2 [] resize(Shape2 [] array,int newSize)
{
String [] original = array;
int numToCopy = Math.min(original.length, newSize);
array =new Shape2[newSize];
for(int i = 0; i < numToCopy; i++)
{
array[i] = original[i];
}
return array;
}

