reset password
Author Message
knagrec2
Posts: 51
Posted 10:55 Oct 24, 2018 |

I don't see the reason it is concrete, you would basically never need to instantiate it. Also following OOP there is technically no such thing as an "object". There are sub classes, or types, of objects in the real world, but there is no such thing as a pure object. That same rule is why Geometric Object is abstract - so then why is Object concrete? Of all classes I would expect that one to be abstract.

kknaur
Posts: 540
Posted 11:21 Oct 24, 2018 |
knagrec2 wrote:

I don't see the reason it is concrete, you would basically never need to instantiate it. Also following OOP there is technically no such thing as an "object". There are sub classes, or types, of objects in the real world, but there is no such thing as a pure object. That same rule is why Geometric Object is abstract - so then why is Object concrete? Of all classes I would expect that one to be abstract.

This is a really good question and one that I never thought of myself.  Based on what we now know about abstract classes, Object does intuitively feel like it would lend itself to being declared as abstract.  So...why isn't it?  The general consensus in researching this online seems to be that you would have to ask the original Java developers why they made this particular design decision.  Any answer to this question is pure speculation by us programmers who use the language.

One easy explanation that I found was, sometimes you may just need an instance of a general Object for testing purposes, or because you may not want to just set a reference variable to some null value.

I liked this response on StackOverflow so take a look and see what you think.