I am writing a class of
Polygon and after thinking about it I decided to use arrays of
y values and save the dots.
This led me to think, out of laziness, about this:
int x, y; x = y = new int[NUM];
I know that arrays are classes and not considered as primitive so what will happen here?
On one hand,
y are arrays of primitive so the array is partially considered as primitive. So it may copy the values to a new array, like normal
int x, y; x = y = 5;
But if it is not primitive then
y will point to the same place in the memory and will have the same variable. When you edit one, the second will be edited too.
MyClass x, y; x = y = new MyClass(value);
So, my question is, which one of the following ideas is right?