Consider the following program and choose the right option from the given list:
class Base {/*from ww w. jav a2 s .c om*/ public void test() { protected int a = 10; // #1 } } class Main extends Base { // #2 public static void main(String[] args) { System.out.printf(null); // #3 } }
a)
Statement #1 will result in a compiler error since the keyword protected is not allowed inside a method body.
You cannot provide access specifiers (public, protected, or private) inside a method body.
option b) It is acceptable to extend a base class and hence there is no compiler error in line marked with comment #2.
option c) It is acceptable to pass null to printf function hence there is no compiler error in line marked with comment #2.
option d) this program will not compile cleanly and hence this option is wrong.