hi,
this q is from Thinking in
java.
create 2 classes A and B with constructors that have arguments. Inherit a new class called C from A, create a member B inside C. Create a constructor for C and perform all initializatio within C's constructor. can anyone suggest a code for this. mine(given below give a compiler error-"No constructor matching A() found in class A"
class A {
int i;
A(int k) {
System.out.println("in A");
i = k;
}
}
class B {
int j;
B(int k) {
System.out.println("in B");
j = k;
}
}
public class C extends A {
B b = new B(4);
C() {
System.out.println("in C");
}
public static void main(
String[] arrgs) {
C c = new C();
}
}