Multiple Choice Question

Quiz Guidelines

 

QID: 
213
Question: 

What will the following code print when run?

class Baap {
public int h = 4;
public int getH() {
System.out.println("Baap " + h);
return h;
}
}   public class Beta extends Baap {
public int h = 44;
public int getH() {
System.out.println("Beta " + h);
return h;
}   public static void main(String[] args) {
Baap b = new Beta();
System.out.println(b.h + " " + b.getH());
Beta bb = (Beta) b;
System.out.println(bb.h + " " + bb.getH());
}
}

Select 1 option

A. Beta 44
4 44
Baap 44
44 44
B. Baap 44
4 44
Beta 44
44 44
C. Beta 44
4 44
Beta 44
4 44
D. Beta 44
4 44
Beta 44
44 44

Q&A Set: 

Search the Web

Custom Search

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