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(void) throws IOException{} void examians() throws IOException{} void examians() {} throws IOException void examians() throw IOException{} examians() throws IOException{} void examians(void) throws IOException{} void examians() throws IOException{} void examians() {} throws IOException void examians() throw IOException{} 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)); } } 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 None of these 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 ? A a = new B(5); All of these None of these A a = new B(); A a = new A(String s); A a = new B(5); All of these None of these A a = new B(); A a = new A(String s); 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 one two two one one None of these Compilation Error one Exception one one two two one one None of these Compilation Error one Exception ANSWER DOWNLOAD EXAMIANS APP
JAVA Constructors and Methods public class MyClass{ }For the above class(MyClass) what is the correct way of declaring constructor? public MyClass(void){} public MyClass(){} 1 and 3 MyClass(){} MyClass(void) {} public MyClass(void){} public MyClass(){} 1 and 3 MyClass(){} MyClass(void) {} 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);}} Method 2 Compile time error as final method can't be overloaded Method 1 None of these Method 2 Compile time error as final method can't be overloaded Method 1 None of these ANSWER DOWNLOAD EXAMIANS APP