 |
As the new Java.net infrastructure contains project-level wikis, this main wiki will be shut down in the near future. For wiki page export and general wiki questions please contact the site admin at communitymanager@java.net.
Default Versus No-Argument Constructors
Java makes a distinction between these two, which is often ignored.
A no-argument constructor is simply a constructor which takes no arguments.
The default constructor is a special kind of no-argument constructor. If no constructor whatsoever is provided by the programmer, then the system will always provide a default constructor, whose behavior is defined by this spec.
So, strictly speaking, a programmer can never write a default constructor (but they can certainly write a no-argument constructor).
-- JohnOHanley - 24 Jul 2003
The above might be amended for this case: a no-arg constructor can have an implementation which simply mimics the behavior of the default constructor.
-- JohnOHanley - 01 Aug 2003
Should "system" be replaced by the Java compiler since it's the compiler that will automatically insert a default constructor into the class file?
-- Main.redwolf - 27 Aug 2003
|