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

Class A method
None of these
Compilation Error
Class B method
Runtime Error

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();}}

Compilation Error
Class Two method1
Nothing will be printed
Class One 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

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(); }}

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

ANSWER DOWNLOAD EXAMIANS APP