JAVA Constructors and Methods Which of the modifier can't be used for constructors? private protected static public private protected static public ANSWER DOWNLOAD EXAMIANS APP
JAVA Constructors and Methods The finalize() method is called just prior to A variable goes out of scope. An object or variable goes out of scope. Before garbage collection. None of these An object, variable or method goes out of scope. A variable goes out of scope. An object or variable goes out of scope. Before garbage collection. None of these An object, variable or method goes out of scope. ANSWER DOWNLOAD EXAMIANS APP
JAVA Constructors and Methods Given the following piece of code:class Person{ public int number;}public class Test{ public void doIt(int i , Person p){ i = 5; p.number = 8; } public static void main(String args[]){ int x = 0; Person p = new Person(); new Test().doIt(x, p); System.out.println(x + " " + p.number); }}What is the result? 0 8 5 0 0 0 5 8 0 8 5 0 0 0 5 8 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 Exception None of these two one one Compilation Error one one two one Exception None of these two one one Compilation Error one one two 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(){} 1 and 3 MyClass(void) {} MyClass(){} public MyClass(void){} public MyClass(){} 1 and 3 MyClass(void) {} MyClass(){} public MyClass(void){} ANSWER DOWNLOAD EXAMIANS APP
JAVA Constructors and Methods What will be the return type of a method that not returns any value? None of these double void int None of these double void int ANSWER DOWNLOAD EXAMIANS APP