Think of it this way; when you do new point[5]
(you should follow coding standards and name your classes with an upper case first letter btw.), you get an array with every element being the default value for that type (in this case null). The array is initialised, but if you want individual elements of the array to be initialised, you have to do that as well, either in the initial line like this:
point[] p1 = new point[] { new point(), new point() };
(The above method will create an array with each element already initialised of the minimum size that will accommodate those elements - in this case 2.)
Or by looping through the array and adding the points manually:
point[] p1 = new point[5];
for (int i = 0; i < p1.length; i++) {
point[i] = new point();
}
Both these concepts can be extended to multi-dimensional arrays:
point[] p2 = new point[][] {
new point[] { new point(), new point() }
new point[] { new point(), new point() }
};
Or
point[] p2 = new point[5][5];
for (int i = 0; i < p2.length; i++) {
for (int j = 0; j < p2[i].length; j++) {
p2[i][j] = new point();
}
}