You can use the operator == to check whether two variables refer to the same array.
查看答案
The arguments passed to the main method is an array of strings. If no argument is passed, args.length is 0.
A. true
B. false
Which correctly creates an array of five empty Strings?
A. String[ ] a = new String [5]; for (int i = 0; i < 5; a[i++] = null);
B. String[] a = new String [5];
C. String[] a = {"", "", "", "", ""};
D. String[5] a;
Analyze the following code. public class Test {public static void main(String[] args) {int[] x = new int[3];System.out.println("x[0] is " + x[0]);} }
A. The program has a runtime error because the array element x[0] is not defineD.
B. The program runs fine and displays x[0] is 0.
C. The program has a compile error because the size of the array wasn't specified when declaring the array.
D. The program has a runtime error because the array elements are not initializeD.
Analyze the following code: public class Test1 { public static void main(String[] args) {xMethod(new double[]{3, 3});xMethod(new double[5]);xMethod(new double[3]{1, 2, 3});} public static void xMethod(double[] a) { System.out.println(A.length);} }
A. The program has a runtime error because a is null.
B. The program has a compile error because xMethod(new double[5]) is incorrect.
C. The program has a compile error because xMethod(new double[]{3, 3}) is incorrect.
D. The program has a compile error because xMethod(new double[3]{1, 2, 3}) is incorrect.