JAVA Constructors and Methods Which of the modifier can't be used for constructors? public protected static private public protected static private 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 1 Compile time error as final method can't be overloaded None of these Method 2 Method 1 Compile time error as final method can't be overloaded None of these Method 2 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 succeed but no output. Compilation fails due to an error on line 2 One Compilation fails due to an error on line 1 Compilation succeed but no output. Compilation fails due to an error on line 2 One Compilation fails due to an error on line 1 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){} MyClass(void) {} 1 and 3 public MyClass(){} MyClass(){} public MyClass(void){} MyClass(void) {} 1 and 3 public MyClass(){} MyClass(){} ANSWER DOWNLOAD EXAMIANS APP
JAVA Constructors and Methods What will be the return type of a method that not returns any value? void double None of these int void double None of these int ANSWER DOWNLOAD EXAMIANS APP
JAVA Constructors and Methods The variables declared in a class for the use of all methods of the class are called None of these reference variables instance variables objects None of these reference variables instance variables objects ANSWER DOWNLOAD EXAMIANS APP