milind k das wrote:So when you say new GeometricObject, is it not creating an array for 10 GeometricObject objects?
Indeed it is. But when you create an array, it doesn't contain any objects; all of its entries are null. It's up to you to put the objects into it.
And yes, the purpose of the new operator is to create an object. And an array is an object, which is why new GeometricObject creates an array.
As for the relevance of abstract classes to that: It's true that you can't create an object whose class is GeometricObject, because that's an abstract class. But you can create an object whose class is GeometricObject, which is an array. That array is not an abstract class; arrays cannot be abstract.
milind k das wrote:Is there a learning mistake I'm doing or what should I do to avoid this kind of issues?
The mistake is not validating what you thought would happen against what actually happens.
It's good that you're trying to think like you're the Java compiler of JVM but once you think you know what the compiler or JVM would do, you should validate your idea against what actually happens when you compile and/or run the code. If you don't complete the postulate-then-validate feedback cycle then your learning will not be complete.
The best ideas are the crazy ones. If you have a crazy idea and it works, it's really valuable.—Kent Beck