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() throw IOException{} 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 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 Compilation Fails Prints 0 None of these Prints 10 Prints 7 Compilation Fails Prints 0 None of these ANSWER DOWNLOAD EXAMIANS APP
JAVA Constructors and Methods The main method should be static for the reason 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. It can be executed without creating any instance of the class. It can be accessed easily by the class loader. None of these ANSWER DOWNLOAD EXAMIANS APP
JAVA Constructors and Methods The finalize() method is called just prior to A variable goes out of scope. An object, variable or method goes out of scope. Before garbage collection. None of these An object or variable goes out of scope. A variable goes out of scope. An object, variable or method goes out of scope. Before garbage collection. None of these An object or variable goes out of scope. 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 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 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 Compilation fails due to an error on line 2 One Compilation succeed but no output. ANSWER DOWNLOAD EXAMIANS APP