JAVA Inheritence
Which of the following is true?1. A class can extend more than one class.2. A class can extend only one class but many interfaces.3. An interface can extend many interfaces.4. An interface can implement many interfaces.5. A class can extend one class and implement many interfaces.

3 and 5
1 and 2
3 and 4
2 and 4
2 and 5

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

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

ANSWER DOWNLOAD EXAMIANS APP

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
Compile time error
Run Time error
Compiles successfully and print

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

ExamiansDerived
BaseExamiansDerived
ExamiansBaseDerived
Compilation Error
ExamiansDerivedBase

ANSWER DOWNLOAD EXAMIANS APP