Content received from: http://JavaFAQ.nu/java-article64.html


Question: Is it new Java feature that my class has no constructor?
Monday, February 24, 2003 (00:00:00)

Posted by jalex

Question: My Java class has no constructor!!!? Is it new Java feature, like generics?

I read that Java creates a default constructor for every class if I do not do it myself -default one, without arguments.

I wrote small program where I defined my constructor with two arguments. But in another place I still need an empty constructor (without arguments).

And my compiler complains that it can not find it!

Answer: Java creates a default constructor if you have no constructors at all.

If you create even one with arguments a default constructor will not be created and it is your responsibility to add it into a program.