Sail E0 Webinar
Question
What is the output for the below code ?class A{ private void printName(){ System.out.println("Value-A"); }}class B extends A{ public void printName(){ System.out.println("Name-B"); }}public class Test{ public static void main (String[] args){ B b = new B(); b.printName(); }}
Options:
A .  None of these
B .  Name-B
C .  Compilation fails - private methods can't be override
D .  Value-A
E .  Value-A Name-B
Answer: Option B

Submit Your Solution Below and Earn Points !
Next Question

Submit Solution

Your email address will not be published. Required fields are marked *

More Questions on This Topic :

Latest Videos

Latest Test Papers