Page 1 of 1

class A { private int x; private int y; public A(int x, int y) { this.x = x; this.y = y; } } Class B is a sub

Posted: Sun May 15, 2022 11:41 am
by answerhappygod
class A {
private int x;
private int y;

public A(int x, int y) {
this.x = x;
this.y = y;
}
}

Class B is a subclass of A. Which of the following can be constructors in B?

I:
public B() {
}

II:
public B(int x, int y) {
super(x, y);
}

III:
public B() {
super(0, 0);
}

IV:
public B(int x, int y) {
this.x = x;
this.y = y;
}