We help IT Professionals succeed at work.

default constructor and arguments

Last Modified: 2019-01-10
class Parent {
    Parent(int number) {
class Child extends Parent {
    Child(int a, int b) {

Open in new window

for above code do not i need to give  constructor as below with two arguments?

      Parent(int a, int b){}
//if i give constructor like above does it still called default constructor?

what is the meaning of below sentence?
4. The default constructor is only generated by the compiler:
If we explicitly write a constructor that looks exactly the same as the default constructor, it is NOT called the default constructor.
Please advise
Watch Question

"Batchelor", Developer and EE Topic Advisor
Top Expert 2015
This one is on us!
(Get your first solution completely free - no credit card required)
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.