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 ? All of these None of these A a = new B(5); A a = new B(); A a = new A(String s); All of these None of these A a = new B(5); A a = new B(); A a = new A(String s); ANSWER DOWNLOAD EXAMIANS APP
JAVA Constructors and Methods Which of the modifier can't be used for constructors? static private protected public static private protected public 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();}} Runtime Exception Wild Animal Compilation Error Animal Wild Runtime Exception Wild Animal Compilation Error Animal Wild 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 int void double None of these int void double ANSWER DOWNLOAD EXAMIANS APP
JAVA Constructors and Methods What is the expected output?public class Profile {private Profile(int w) { // line 1System.out.print(w);}public final Profile() { // line 5System.out.print(10);}public static void main(String args[]) {Profile obj = new Profile(50);}} Won't compile because of line (1); constructor can't be private 50 Won't compile because of line (5); constructor can't be final 10 50 Won't compile because of line (1); constructor can't be private 50 Won't compile because of line (5); constructor can't be final 10 50 ANSWER DOWNLOAD EXAMIANS APP
JAVA Constructors and Methods public class Test { }What is the prototype of the default constructor? Test( ) public Test(void) public Test( ) None of these Test(void) Test( ) public Test(void) public Test( ) None of these Test(void) ANSWER DOWNLOAD EXAMIANS APP