The question is really based on 2 simple concepts :
1. If class's constructor does not call any of the super class's constructor explicitly then the compiler will automatically insert super(); as the first line of that constructor. (meaning a call to no args constructor of the super class)
2. Default (no args) contrustructor is automatically generated by the compiler
iff the programmer does not define ANY CONTRUCTOR AT ALL.
Now, to satisfy
public SubClass( int m ) { super(m ); } //2
you need: public SuperClass(int a) in SuperClass.
But the moment you put a constructor explicitly, the compiler will not generate the default constructor (Because of rule 2 above)for the super class . So
public SubClass( int m, int n ) { i = m ; j = m ; } //1
will fail because of rule 1.
HTH,
Paul.
------------------
Get Certified, Guaranteed!
www.enthuware.com/jqplus
SCJP2 Resources, WebCompiler, Compare Mock Exam Results and More!
www.jdiscuss.com Your guide to
SCJD exam!
www.enthuware.com/jdevplus