I have an abstract class MousableActor
that extends a concrete class Actor
:
public abstract class MousableActor extends Actor
{
/**
* Constructs a MousableActor.
*/
protected void MousableActor()
{
}
}
When I look at the javadoc generated for the class, I see a public no-args constructor:
According to Section 8.8.9 of the JLS:
If a class contains no constructor declarations, then a default constructor with no formal parameters and no throws clause is implicitly declared.
I always considered that an if-and-only-if. Why is a public default constructor being created even though I explicitly declared a protected constructor? Does it have something to do with the superclass having a public no-args constructor?
I am using Greenfoot version 2.4.2 (which shouldn't matter) on top of Java 1.8.0.
A constructor is not a void
method.
protected void MousableActor()
should be
protected MousableActor()