JAVA Constructors and Methods The variables declared in a class for the use of all methods of the class are called reference variables objects None of these instance variables reference variables objects None of these instance variables ANSWER DOWNLOAD EXAMIANS APP
JAVA Constructors and Methods Which of the modifier can't be used for constructors? private static public protected private static public protected ANSWER DOWNLOAD EXAMIANS APP
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 A a = new A(String s); None of these A a = new B(); A a = new B(5); All of these A a = new A(String s); None of these A a = new B(); A a = new B(5); 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 10 50 Won't compile because of line (5); constructor can't be final 50 Won't compile because of line (1); constructor can't be private 10 50 Won't compile because of line (5); constructor can't be final 50 ANSWER DOWNLOAD EXAMIANS APP
JAVA Constructors and Methods Which of these is a legal definition of a method named examveda assuming it throws IOException, and returns void. Also assume that the method does not take any arguments. Select the one correct answer. void examians() {} throws IOException examians() throws IOException{} void examians() throw IOException{} void examians() throws IOException{} void examians(void) throws IOException{} void examians() {} throws IOException examians() throws IOException{} void examians() throw IOException{} void examians() throws IOException{} void examians(void) throws IOException{} ANSWER DOWNLOAD EXAMIANS APP
JAVA Constructors and Methods What will be the result of compiling and running the given code?class A{ int b=10; private A(){ this.b=7; } int f(){ return b; }}class B extends A{ int b;}public class Test{ public static void main(String[] args){ A a = new B(); System.out.println(a.f()); }} Prints 0 None of these Prints 7 Compilation Fails Prints 10 Prints 0 None of these Prints 7 Compilation Fails Prints 10 ANSWER DOWNLOAD EXAMIANS APP