Question: java what is the right answer 1, 2, 3,4 Question 1 (CLO 1.2): Choose the correct answer (4 marks). 1. What is the correct declaration
Question 1 (CLO 1.2): Choose the correct answer (4 marks). 1. What is the correct declaration of an object's reference variable o? a) public class 0 ; (b) String o; c) new String 0 o; d) int 0 ; 2. When an array of objects is created, each element in the array is a) a reference variable with a default value of 0 . b) an integer variable with a default value of 0 . c) a reference variable with a default value of 1. (d) a reference variable with a default value of null. 3. The .. keyword can be used to invoke another constructor of the same class. super b) extends 9) this d) new 4. What is the output of the following code? public class Test f public static void main(String[] args) f a) compilation error int [ a {1,2}; b) logic error ssap(a[0], a(1)): Systen. out.printinn("a[0] ="+a[0] c) a[0]=1a[1]=2 1 public static void swap(int n1, int n2) f (d) a[0]=2a[1]=1 int temp =ni; n2n2i 1
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
