Multiple Choice Question

Quiz Guidelines

 

QID: 
365
Question: 

Consider the following code:

class A{
A() { print(); }
void print() { System.out.println("A"); }
}class B extends A{
int i = Math.round(3.5f);
public static void main(String[] args){
A a = new B();
a.print();
}
void print() { System.out.println(i); }
}

What will be the output when class B is run ?

Select 1 option

A. It will print A, 4.
B. It will print A, A
C. It will print 0, 4
D. It will print 4, 4
E. None of the above.

Q&A Set: 

Search the Web

Custom Search

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