The professional, friendly Java community. 21,500 members and growing!

The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.

when the TimePrinter class have no constructor. From what I read, if a class have no constructor, it will then call the superclass of TimePrinter, which is Object, and use the default no-arg constructor. But I think its a bit confusing for me to create a class without constructor but only a method. Can somebody lighten me up on this a little bit more?

Re: Construct a class that implement ActionListener with no constructor

In Java, if you have no explicitly defined constructor, there's a default constructor which initializes all values to their "default" value, i.e. nulls, 0's, etc. This is what's known as a an implicit constructor. Note that once you provide even 1 constructor for the class, you no longer get the implicit constructor.