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

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

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 Person
I am a Student
I am a Student 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(); }}

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

ANSWER DOWNLOAD EXAMIANS APP