Multiple Choice Question

Quiz Guidelines

 

QID: 
364
Question: 

Given the following classes and declarations, which of these statements about //1 and //2 are true?

class A{
private int i = 10;
public void f(){}
public void g(){}
}class B extends A{
public int i = 20;
public void g(){}
}public class C{
A a = new A();//1
A b = new B();//2  }    

Select 1 option

A. System.out.println(b.i); will print 10.
B. The statement b.f( ); will give compile time error..
C. System.out.println(b.i); will print 20
D. All the above are correct.
E. None of the above statements is correct.+

Q&A Set: 

Search the Web

Custom Search

Searches whole web. Use the search in the right sidebar to search only within javajee.com!!!