Metasyntactic
Ars Legatus Legionis
Nope. it's not possible. You cannot return 'null' in a constructor. Indeed, you can't return anything.Further research pointed me toward "Singletons", which ensure that only one instance of a class is instantiated. I can see a scenario where you'd want that. The getInstance() method checks to see if an object of that class already exists in the program. It returns null if an object exists. Couldn't you build that logic into the constructor?
Furthermore, if i call "new Foo" then i will *always* get an instance of the actual Foo type, and not, potentially, one of it's subclasses.
However, if i have "Foo getInstance(...)" then i can return an instance of Foo, or one of its subclasses.
I may return a GregorianFoo, or a JulianFoo. etc. etc.
Constructors (in java), have no ability to do this. Though it's potentially something that could be added to the language. We've discussed it in C#, but shied away from it as it's so different from how people think of "new" today.