JAVA Constructors and Methods Which of the modifier can't be used for constructors? protected private static public protected private static public ANSWER DOWNLOAD EXAMIANS APP
JAVA Constructors and Methods public class Test { }What is the prototype of the default constructor? public Test( ) None of these Test(void) public Test(void) Test( ) public Test( ) None of these Test(void) public Test(void) Test( ) ANSWER DOWNLOAD EXAMIANS APP
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(void) throws IOException{} void examians() {} throws IOException examians() throws IOException{} void examians() throw IOException{} void examians() throws IOException{} void examians(void) throws IOException{} void examians() {} throws IOException examians() throws IOException{} void examians() throw IOException{} void examians() throws IOException{} 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++; }} Compilation Error 2 None of these 3 1 Compilation Error 2 None of these 3 1 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);}} None of these Method 1 Method 2 Compile time error as final method can't be overloaded None of these Method 1 Method 2 Compile time error as final method can't be overloaded 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 5 8 0 0 0 8 5 0 5 8 0 0 ANSWER DOWNLOAD EXAMIANS APP