0

Just learning about them now and very new to java.

3
  • stackoverflow.com/questions/4488716/java-default-constructor Commented Feb 13, 2013 at 16:12
  • 7
    @Makoto: That's simply not true. If you provide a different constructor, the compiler won't supply a parameterless one. Commented Feb 13, 2013 at 16:12
  • @Makoto From the link provided by NPE: if you define at least one constructor, the default constructor is not generated, and then check the best reference for the answer Commented Feb 13, 2013 at 16:14

2 Answers 2

6

No. If any constructor is defined, there is no default constructor (i assume you mean no-argument constructor) unless you explicitly define it. If no constructors are defined, then the default constructor is implied.

Sign up to request clarification or add additional context in comments.

Comments

1

If you provide a constructor for your object then it will be used. If you don't call it java won't call the no-argument constructor thus you have to provide it yourself.

I think the official java documentation here provides some examples which are simple to understand.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.