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(void) throws IOException{} void examians() {} throws IOException void examians() throws IOException{} examians() throws IOException{} void examians() throw IOException{} void examians(void) throws IOException{} void examians() {} throws IOException ANSWER DOWNLOAD EXAMIANS APP
JAVA Constructors and Methods The finalize() method is called just prior to A variable goes out of scope. None of these An object, variable or method goes out of scope. Before garbage collection. An object or variable goes out of scope. A variable goes out of scope. None of these An object, variable or method goes out of scope. Before garbage collection. An object or variable goes out of scope. ANSWER DOWNLOAD EXAMIANS APP
JAVA Constructors and Methods class MyClass{ MyClass(){ System.out.print("one"); } public void myMethod(){ this(); System.out.print("two"); }} public class TestClass{ public static void main(String args[]){ MyClass obj = new MyClass(); obj.myMethod(); }} one Exception one one two two one one Compilation Error None of these one Exception one one two two one one Compilation Error None of these ANSWER DOWNLOAD EXAMIANS APP
JAVA Constructors and Methods What is the output of the above program ?class Num { Num(double x ){ System.out.println( x ) ; } }public class Test extends Num { public static void main(String[] args){ Num num = new Num( 2 ) ; } } 2.0 None of these 0 Compile time error 2.0 None of these 0 Compile time error 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()); }} None of these Prints 10 Compilation Fails Prints 0 Prints 7 None of these Prints 10 Compilation Fails Prints 0 Prints 7 ANSWER DOWNLOAD EXAMIANS APP
JAVA Constructors and Methods Determine output:public class Test{ public static void main(String args[]){ MyClass obj = new MyClass(); obj.val = 1; obj.call(obj); System.out.println(obj.val); }}class MyClass{ public int val; public void call(MyClass ref){ ref.val++; }} 3 2 None of these Compilation Error 1 3 2 None of these Compilation Error 1 ANSWER DOWNLOAD EXAMIANS APP