Consider the following program and predict the behavior:
class base1 {//from w ww . j av a 2 s .c o m protected int var; } interface base2 { int var = 0; // #1 } class Test extends base1 implements base2 { // #2 public static void main(String args[]) { System.out.println("var:" + var); // #3 } }
c)
Statement #1 and #2 will not raise any alarm; only access to the variable var will generate an error since the access is ambiguous (since the variable is declared in both base1 and base2).