Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Java Hibernate Basics Getting Started with Hibernate Adding a POJO with JPA Annotations

Adrian Grabowski
Adrian Grabowski
2,622 Points

Default constructor?

As far as I know the default constructor is the one added by the compiler if we don't write any. So if we write our own zero-args constructor it should not be called a "default constructor" in my opinion.

1 Answer

Aleksander Henriksen
Aleksander Henriksen
3,059 Points

True the default constructor is a constructor the compiler maked, and it takes no arguments, therefore is it a no-arg constructor, but there is a differnce between the default and no-arg constructor.

When you are makeing a constructor that takes some sort of arguments, are you going to delete the default constructor, but the no-arg constructor that you made you self are going to stay till you delete yourself.