Can a class have no constructor?

It is not required to explicitly define a constructor; however, all classes must have a constructor, and a default empty constructor will be generated if you don’t provide any:

public Maze() {
}

See Default Constructor.

Leave a Comment