JAVA Overriding and Overloading
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(); }}

Name-B
Value-A Name-B
Value-A
None of these
Compilation fails - private methods can't be override

ANSWER DOWNLOAD EXAMIANS APP

JAVA Overriding and Overloading
What will be the output?interface A{public void method1();}class One implements A{public void method1(){System.out.println("Class One method1");}}class Two extends One{public void method1(){System.out.println("Class Two method1");}}public class Test extends Two{public static void main(String[] args){A a = new Two();a.method1();}}

Nothing will be printed
Compilation Error
Class One method1
Class Two method1

ANSWER DOWNLOAD EXAMIANS APP

JAVA Overriding and Overloading
what is the result of the following piece of code:public class Person{ public void talk(){ System.out.print("I am a Person"); }}public class Student extends Person{ public void talk(){ System.out.print("I am a Student"); }}public class Test{ public static void main(String args[]){ Person p = new Student(); p.talk(); }}

I am a Student
I am a Student I am a Person
I am a Person
I am a Person I am a Student

ANSWER DOWNLOAD EXAMIANS APP