Link to home
Start Free TrialLog in
Avatar of gudii9
gudii9Flag for United States of America

asked on

default constructor and arguments

class Parent {
	//Parent(){}
	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.
https://www.codejava.net/java-core/the-java-language/9-rules-about-constructors-in-java
Please advise
ASKER CERTIFIED SOLUTION
Avatar of Qlemo
Qlemo
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial