Note that the constructor public DerivedDemo(int x, int y) is not explicitly calling the base class version like the other one public DerivedDemo(int x).Then it will call a default no args constructor of the super class. So we must provide a Demo() no args constructor in the Demo class.
This is not provided by the compiler because there is already a constructor Demo(int) in the super class.
Hi, I met a quite hard question in bill's mock simulation:
Given the following class definition:
1.public class DeriveDemo extends Demo{
2. int M,N,L;
3. public DerivedDemo(int x, int y){
4. M=x; N=y;
5. }
6. public DerivedDemo(int x){
7. super(x);
8. }
9.}