posted 24 years ago
there is this problem in km's mock exam:
class A {
protected int i;
A(int i) {
this.i = i;}}
Which of the following would be a valid inner class for this class?
and it says that this answer would be wrong-
class B {
B() {
System.out.println("i = " + i);}}
the reason given is-
this implicitly invokes the no-args constructor, which A does not define.
i say, it doesn't! A is not the super of B, and we can very well instantiate B like this:
A.B b = new A(15).new B();
am i wrong?