Hey guys, I have time with the problem of “extensions” with a problem in the set of problems I'm working on - I think I just have a block because it is written to purposefully mislead, Here's the problem I gave:
class A {
int x;
A(int a) {System.out.println(" class A");}
}
class B extends A {
int x;
B() {System.out.println(" class B");}
public static void main (String [] args) {
A a = new B();
}
}
When I compile, I get the following error ripped from the console:
cannot find symbol
symbol : constructor A()
location: class A
B() {System.out.println(" class B");}
^
and I should be able to correct this error in class B without touching class A. I obviously lack something stupid obvious, but I tried permuting everything that I can think about for an hour and not working,
So far I have tried:
- throws a void before B () - the same error.
- creating B () in (int a) - the latter returns with an invalid declaration of the method declaration (adding a void in front of it returns me to the original error "cannot find character")
- B() B (int a) - " ", B().
- B A B A (int A) - . , .
- A Apple , , - A (int a) Apple, .
? , , . .