Kizspy | Question: 23
(Choose 1 answer)
What is the output of the following Java program?
class A {
public int x = 1;
public void setX(int a) {
}
x = a;
class B extends A {
public int getB() {
setX(2);
return x;
public class Main {
public static void main(String[] args) {
A a = new A();
B b = new B();
System.out.println(a.x + " " + b.getB());
A. 12
B. 21
C. 11
D. 22