0
why use contractor in method overriding
2 Antworten
+ 1
Do you mean constructor? You can override any method, not just those.
0
It's a good idea to have a no argument constructor.
You don't always want to supply an argument to a constructor.
In fact, there is a design principle for classes called Java Beans where it is a requirement to have a no argument constructor.
You can also create more constructors and supply them with parameters. The compiler will know which one to refer to based on the supplied parameters.