多项选择题
Which two code fragments correctly create and initialize a static array of int elements?()
A. static final int[] a = { 100,200 };
B. static final int[] a; static { a=new int[2]; a[0]=100; a[1]=200; }
C. static final int[] a = new int[2] { 100,200 };
D. static final int[] a; static void init() { a = new int[3]; a[0]=100; a[1]=200; }
点击查看答案&解析
相关考题
-
多项选择题
35. String #name = “Jane Doe”; 36. int$age=24; 37. Double_height = 123.5; 38. double~temp = 37.5; Which two are true?()
A. Line 35 will not compile.
B. Line 36 will not compile.
C. Line 37 will not compile.
D. Line 38 will not compile. -
单项选择题
55. int []x= {1, 2,3,4, 5}; 56. int y[] =x; 57. System.out.println(y[2]); Which is true?()
A. Line 57 will print the value 2.
B. Line 57 will print the value 3.
C. Compilation will fail because of an error in line 55.
D. Compilation will fail because of an error in line 56. -
单项选择题
1. public class Test { 2. int x= 12; 3. public void method(int x) { 4. x+=x; 5. System.out.println(x); 6. } 7. } Given: 34. Test t = new Test(); 35. t.method(5); What is the output from line 5 of the Test class?()
A. 5
B. 10
C. 12
D. 17
E. 24
