Answer (Choose 1 answer)
This question concerns the following class definition:
1. package one;
2.
3. public class Bird {
4.protected static int k = 0;
45670 6.7.
5.public Bird() { k++; }
protected void fly() {}
8.}static int getValue() { return(k); }
Which statement is true about class Bird and the following class Grebe?
1. package two;
2.
3. class Parrot extends one. Bird {
4.Parrot() { k++; }
5.
6.public static void main(String args[]) { System.out.print("Before: " + k);
7.
8.Parrot x = new Parrot();
9.10.System.out.println(" After: " + k);
x.fly();
11. }
12.}
A. The program will compile and execute. The output will be Before: 0 After: 2.
B. The program will compile and execute. The output will be Before: 0 After: 1.
C. Compilation of Parrot will fail at line 4 because static members cannot be overridden.
ID Compilation of Parrot will fail at line 10 because method flv() is protected in the superclass
Exit 20