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. examians() throws IOException{} void examians() {} throws IOException void examians() throw IOException{} void examians(void) throws IOException{} void examians() throws IOException{} examians() throws IOException{} void examians() {} throws IOException void examians() throw IOException{} void examians(void) throws IOException{} void examians() throws IOException{} ANSWER DOWNLOAD EXAMIANS APP
JAVA Constructors and Methods What is the output of the program?class Test{ public int display(int x, int y){ return ("The sum of x and y is " + x + y); } public static void main(String args[]){ Test test = new Test(); System.out.println(test.display(4,5)); } } None of these does not compile The sum of x and y is 45 The sum of x and y is 9 None of these does not compile The sum of x and y is 45 The sum of x and y is 9 ANSWER DOWNLOAD EXAMIANS APP
JAVA Constructors and Methods Determine Output:class A{public static void method(int i){System.out.print("Method 1");}public static int method(String str){System.out.print("Method 2");return 0;}}public class Test{ public static void main(String args[]){A.method(5);}} Compile time error as final method can't be overloaded Method 1 Method 2 None of these Compile time error as final method can't be overloaded Method 1 Method 2 None of these ANSWER DOWNLOAD EXAMIANS APP
JAVA Constructors and Methods The implicit return type of a constructor is void None of these There is no return type. A class object in which it is defined. void None of these There is no return type. A class object in which it is defined. 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 ) ; } } Compile time error 0 2.0 None of these Compile time error 0 2.0 None of these 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 Compilation succeed but no output. One Compilation fails due to an error on line 1 Compilation fails due to an error on line 2 Compilation succeed but no output. One Compilation fails due to an error on line 1 ANSWER DOWNLOAD EXAMIANS APP