JAVA Inheritence
What will be the output?class Parent{ public void method(){ System.out.println("Hi i am parent"); }}public class Child extends Parent{ protected void method(){ System.out.println("Hi i am Child"); } public static void main(String args[]){ Child child = new Child(); child.method(); }}

None of This
Compiles successfully and print
Compiles successfully and print
Compile time error
Run Time error

ANSWER DOWNLOAD EXAMIANS APP

JAVA Inheritence
What is the result of compiling and running the following code?class Base{ public Base(){ System.out.print("Base"); }}public class Derived extends Base{ public Derived(){ this("Examveda"); System.out.print("Derived"); } public Derived(String s){ System.out.print(s); } public static void main(String[] args){ new Derived(); }}

Compilation Error
ExamiansBaseDerived
BaseExamiansDerived
ExamiansDerived
ExamiansDerivedBase

ANSWER DOWNLOAD EXAMIANS APP

JAVA Inheritence
What will be the result after compiling this code?class SuperClass{ public int doIt(String str, Integer... data)throws Exception{ String signature = "(String, Integer[])"; System.out.println(str + " " + signature); return 1; }}public class Test extends SuperClass{ public int doIt(String str, Integer... data){ String signature = "(String, Integer[])"; System.out.println("Overridden: " + str + " " +signature); return 0; } public static void main(String... args){ SuperClass sb = new Test(); sb.doIt("hello", 3); }}

None of these
Compilation fails
Overridden: hello (String, Integer[])
hello (String, Integer[])

ANSWER DOWNLOAD EXAMIANS APP

JAVA Inheritence
What will be the result of compiling and executing the following program code?class Vehicle{ public void printSound(){ System.out.print("vehicle"); }}class Car extends Vehicle{ public void printSound(){ System.out.print("car"); }}class Bike extends Vehicle{ public void printSound(){ System.out.print("bike"); }}public class Test{ public static void main(String[] args){ Vehicle v = new Car(); Bike b = (Bike) v; v.printSound(); b.printSound(); }}

"vehiclebike" is printed.
"carcar" is printed.
"vehiclecar" is printed.
ClassCastException exception is thrown at runtime.
Compilation fails.

ANSWER DOWNLOAD EXAMIANS APP