JAVA Constructors and Methods Which of the modifier can't be used for constructors? static private protected public static private protected public 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}} One Compilation fails due to an error on line 2 Compilation succeed but no output. Compilation fails due to an error on line 1 One Compilation fails due to an error on line 2 Compilation succeed but no output. Compilation fails due to an error on line 1 ANSWER DOWNLOAD EXAMIANS APP
JAVA Constructors and Methods The main method should be static for the reason It can be executed without creating any instance of the class. None of these It can be accessed by every method or variable without any hindrance. It can be accessed easily by the class loader. It can be executed without creating any instance of the class. None of these It can be accessed by every method or variable without any hindrance. It can be accessed easily by the class loader. ANSWER DOWNLOAD EXAMIANS APP
JAVA Constructors and Methods Determine output of the following program.public class Test{ public static void main(String args[]){ System.out.println( Math.floor( Math.random( ) ) ) ; }} 1.0 10.0 0.0 0.5 1.0 10.0 0.0 0.5 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(); }} Compilation Error one Exception None of these two one one one one two Compilation Error one Exception None of these two one one one one two ANSWER DOWNLOAD EXAMIANS APP
JAVA Constructors and Methods The finalize() method is called just prior to None of these An object, variable or method goes out of scope. A variable goes out of scope. Before garbage collection. An object or variable goes out of scope. None of these An object, variable or method goes out of scope. A variable goes out of scope. Before garbage collection. An object or variable goes out of scope. ANSWER DOWNLOAD EXAMIANS APP