JAVA Constructors and Methods class A{ A(String s){} A(){}}1. class B extends A{2. B(){}3. B(String s){4. super(s);5. }6. void test(){7. // insert code here8. }9. }Which of the below code can be insert at line 7 to make clean compilation ? A a = new A(String s); All of these A a = new B(); A a = new B(5); None of these A a = new A(String s); All of these A a = new B(); A a = new B(5); None of these ANSWER DOWNLOAD EXAMIANS APP
JAVA Constructors and Methods The implicit return type of a constructor is A class object in which it is defined. There is no return type. void None of these A class object in which it is defined. There is no return type. void None of these ANSWER DOWNLOAD EXAMIANS APP
JAVA Constructors and Methods public class Test { }What is the prototype of the default constructor? public Test(void) Test(void) public Test( ) Test( ) None of these public Test(void) Test(void) public Test( ) Test( ) None of these ANSWER DOWNLOAD EXAMIANS APP
JAVA Constructors and Methods What is the expected output?class Animal {Animal() {System.out.println("Animal");}}class Wild extends Animal{Wild() {System.out.println("Wild");super();}}public class Test {public static void main(String args[]) {Wild wild = new Wild();}} Wild Animal Animal Wild Compilation Error Runtime Exception Wild Animal Animal Wild Compilation Error Runtime Exception ANSWER DOWNLOAD EXAMIANS APP
JAVA Constructors and Methods What will be the return type of a method that not returns any value? None of these double void int None of these double void int ANSWER DOWNLOAD EXAMIANS APP
JAVA Constructors and Methods Determine Output:class A{public static void method(int i){System.out.print("Method 1");}public static int method(String str){System.out.print("Method 2");return 0;}}public class Test{ public static void main(String args[]){A.method(5);}} None of these Method 2 Method 1 Compile time error as final method can't be overloaded None of these Method 2 Method 1 Compile time error as final method can't be overloaded ANSWER DOWNLOAD EXAMIANS APP