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 void examians(void) throws IOException{} void examians() throw IOException{} examians() throws IOException{} void examians() throws IOException{} void examians() {} throws IOException void examians(void) throws IOException{} void examians() throw IOException{} examians() throws IOException{} void examians() throws IOException{} ANSWER DOWNLOAD EXAMIANS APP
JAVA Constructors and Methods Which of the modifier can't be used for constructors? static public private protected static public private protected 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 one Exception Compilation Error None of these one one two two one one one Exception Compilation Error None of these ANSWER DOWNLOAD EXAMIANS APP
JAVA Constructors and Methods public class Test { }What is the prototype of the default constructor? Test( ) public Test(void) Test(void) public Test( ) None of these Test( ) public Test(void) Test(void) public Test( ) None of these 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 7 Prints 10 Compilation Fails Prints 0 None of these Prints 7 Prints 10 Compilation Fails Prints 0 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++; }} None of these 2 1 3 Compilation Error None of these 2 1 3 Compilation Error ANSWER DOWNLOAD EXAMIANS APP