JAVA Constructors and Methods The variables declared in a class for the use of all methods of the class are called instance variables None of these objects reference variables instance variables None of these objects reference variables ANSWER DOWNLOAD EXAMIANS APP
JAVA Constructors and Methods public class Test { }What is the prototype of the default constructor? Test( ) public Test( ) Test(void) None of these public Test(void) Test( ) public Test( ) Test(void) None of these public Test(void) ANSWER DOWNLOAD EXAMIANS APP
JAVA Constructors and Methods The main method should be static for the reason It can be executed without creating any instance of the class. It can be accessed easily by the class loader. None of these It can be accessed by every method or variable without any hindrance. It can be executed without creating any instance of the class. It can be accessed easily by the class loader. None of these It can be accessed by every method or variable without any hindrance. 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(void) throws IOException{} void examians() throws IOException{} void examians() throw IOException{} void examians() {} throws IOException examians() throws IOException{} void examians(void) throws IOException{} void examians() throws IOException{} void examians() throw IOException{} ANSWER DOWNLOAD EXAMIANS APP
JAVA Constructors and Methods class MyClass{int i;int j;public MyClass(int i, int j){this.i = i;this.j = j;}public void call(){System.out.print("One");}}public class Test{public static void main(String args[]){MyClass m = new MyClass(); //line 1m.call(); //line 2}} Compilation fails due to an error on line 2 One Compilation succeed but no output. Compilation fails due to an error on line 1 Compilation fails due to an error on line 2 One Compilation succeed but no output. Compilation fails due to an error on line 1 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 10 Prints 7 None of these Compilation Fails Prints 0 Prints 10 Prints 7 None of these Compilation Fails Prints 0 ANSWER DOWNLOAD EXAMIANS APP