JAVA Constructors and Methods public class Test { }What is the prototype of the default constructor? None of these Test(void) public Test( ) public Test(void) Test( ) None of these Test(void) public Test( ) public Test(void) Test( ) ANSWER DOWNLOAD EXAMIANS APP
JAVA Constructors and Methods What will be the return type of a method that not returns any value? int None of these double void int None of these double void ANSWER DOWNLOAD EXAMIANS APP
JAVA Constructors and Methods What is the expected output?public class Profile {private Profile(int w) { // line 1System.out.print(w);}public final Profile() { // line 5System.out.print(10);}public static void main(String args[]) {Profile obj = new Profile(50);}} 50 Won't compile because of line (5); constructor can't be final Won't compile because of line (1); constructor can't be private 10 50 50 Won't compile because of line (5); constructor can't be final Won't compile because of line (1); constructor can't be private 10 50 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( ) ) ) ; }} 10.0 1.0 0.5 0.0 10.0 1.0 0.5 0.0 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 None of these Compilation Error two one one one Exception one one two None of these Compilation Error two one one one Exception 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++; }} 3 None of these 2 Compilation Error 1 3 None of these 2 Compilation Error 1 ANSWER DOWNLOAD EXAMIANS APP