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 int(){a=new int[3];a[0]=100;a[1]=200;}

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 int(){a=new int[3];a[0]=100;a[1]=200;}

相关考题:

Given:Which three methods, inserted individually at line 14, will correctly complete class Two?() A.int foo() { /* more code here */ }B.void foo() { /* more code here */ }C.public void foo() { /* more code here */ }D.private void foo() { /* more code here */ }E.protected void foo() { /* more code here */ }

Click the Exhibit button. Given:Which two statements are true if a NullPointerException is thrown on line 3 of class C? () A.The application will crash.B.The code on line 29 will be executed.C.The code on line 5 of class A will execute.D.The code on line 5 of class B will execute.E.The exception will be propagated back to line 27.

Given that: Gadget has-a Sprocket and Gadget has-a Spring and Gadget is-a Widget and Widget has-a Sprocket Which two code fragments represent these relationships? () A.B.C.D.E.F.

Embedded systems always require the user to manipulate bits inregisters or variables. Given an integer variable a, write two code fragments.The first should set bit 5 of a. The second shnuld clear bit 5 of a. In bothcases, the remaining bits should be unmodified.

class One {  void foo() {}  }  class Two extends One {   //insert method here  }  Which three methods, inserted individually at line 14, will correctly complete class Two?()A、 int foo() { /* more code here */ }B、 void foo() { /* more code here */ }C、 public void foo() { /* more code here */ }D、 private void foo() { /* more code here */ }E、 protected void foo() { /* more code here */ }

The 8859-1 character code for the uppercase letter A is 65. Which of these code fragments declare and initialize a variable of type char with this value?()  A、char ch = 65;B、char ch = ’¥65’;C、char ch = ’¥0041’;D、char ch = ’A’;E、char ch = "A";

public class Team extends java.util.LinkedList {  public void addPlayer(Player p) {  add(p);  }  public void compete(Team opponent) { /* more code here */ }  }  class Player { /* more code here */ }  Which two are true?()A、 This code will compile.B、 This code demonstrates proper design of an is-a relationship.C、 This code demonstrates proper design of a has-a relationship.D、 A Java programmer using the Team class could remove Player objects from a Team object.

Which code fragments will succeed in initializing a two-dimensional array named tab with a size that will cause the expression tab[3][2] to access a valid element?()   CODE FRAGMENT a:  int[][] tab = {  { 0, 0, 0 },  { 0, 0, 0 }  };   CODE FRAGMENT b:  int tab[][] = new int[4][];  for (int i=0; i   CODE FRAGMENT c:  int tab[][] = {  0, 0, 0, 0,  0, 0, 0, 0,  0, 0, 0, 0,  0, 0, 0, 0  };   CODE FRAGMENT d:  int tab[3][2];   CODE FRAGMENT e:  int[] tab[] = { {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0} };  A、Code fragment a.B、Code fragment b.C、Code fragment c.D、Code fragment d.E、Code fragment e.

Which two code fragments will execute the method doStuff() in a separate thread?()A、new Thread() {public void run() { doStuff(); }};B、new Thread() {public void start() { doStuff(); }};C、new Thread() {public void start() { doStuff(); }}.run();D、new Thread() {public void run() { doStuff(); }}.start();E、new Thread(new Runnable() {public void run() { doStuff(); }}).start();

多选题Click the Exhibit button.   Given: Which two statements are true if a NullPointerException is thrown on line 3 of class C?()AThe application will crash.BThe code on line 29 will be executed.CThe code on line 5 of class A will execute.DThe exception will be propagated back to line 27.EThe code on line 5 of class B will execute.

多选题Given:   10. class One {   11. void foo() { }   12. }   13. class Two extends One {   14. //insert method here   15. }   Which three methods, inserted individually at line 14, will correctly complete class Two?()Apublic void foo() { /* more code here */ }Bprivate void foo() { /* more code here */ }Cprotected void foo() { /* more code here */ }Dint foo() { /* more code here */ }Evoid foo() { /* more code here */ }

多选题class One {  void foo() {}  }  class Two extends One {   //insert method here  }  Which three methods, inserted individually at line 14, will correctly complete class Two?()Aint foo() { /* more code here */ }Bvoid foo() { /* more code here */ }Cpublic void foo() { /* more code here */ }Dprivate void foo() { /* more code here */ }Eprotected void foo() { /* more code here */ }

多选题10.publicclassBar{ 11.staticvoidfoo(int...x){ 12.//insertcodehere 13.} 14.} Which two code fragments,inserted independently at line1 2,will allow the class to compile()Aforeach(x)System.out.println(z);Bfor(intz:x)System.out.println(z);Cwhile(x.hasNext())System.out.println(x.next());Dfor(inti=0;i

多选题Given: Which three methods, inserted individually at line 14, will correctly complete class Two?()Aint foo() { /* more code here */ }Bvoid foo() { /* more code here */ }Cpublic void foo() { /* more code here */ }Dprivate void foo() { /* more code here */ }Eprotected void foo() { /* more code here */ }

单选题Given that file is a reference to a File object that represents a directory, which code fragments will succeed in obtaining a list of the entries in the directory?()AVector filelist = ((Directory) file).getList();BString[] filelist = file.directory();CEnumeration filelist = file.contents();DString[] filelist = file.list();EVector filelist = (new Directory(file)).files();

多选题Given that c is a reference to a valid java.io.Console object, which two code fragments read a line of text from the console?()AString s = c.readLine();Bchar[ ] c = c.readLine();CString s = c.readConsole();Dchar[ ] c = c.readConsole();EString s = c.readLine(%s, name );Fchar[ ] c = c.readLine(%s, name );

多选题Which two options can be used as traffic descriptors when classifying and marking traffic? ()Aincoming interfaceBLayer 2 differentiated services code point (DSCP)CLayer 3 IP precedenceDoutgoing interface

多选题Which two code fragments correctly create and initialize a static array of int elements?()AABBCCDD

多选题Which two code fragments correctly create and initialize a static array of int elements?()Astatic final int[] a = { 100,200 };Bstatic final int[] a; static { a=new int[2]; a[0]=100; a[1]=200; }Cstatic final int[] a = new int[2]{ 100,200 };Dstatic final int[] a; static void init() { a = new int[3]; a[0]=100; a[1]=200; }

多选题Which code fragments will succeed in initializing a two-dimensional array named tab with a size that will cause the expression tab[3][2] to access a valid element?()   CODE FRAGMENT a:  int[][] tab = {  { 0, 0, 0 },  { 0, 0, 0 }  };   CODE FRAGMENT b:  int tab[][] = new int[4][];  for (int i=0; i   CODE FRAGMENT c:  int tab[][] = {  0, 0, 0, 0,  0, 0, 0, 0,  0, 0, 0, 0,  0, 0, 0, 0  };   CODE FRAGMENT d:  int tab[3][2];   CODE FRAGMENT e:  int[] tab[] = { {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0} };ACode fragment a.BCode fragment b.CCode fragment c.DCode fragment d.ECode fragment e.

多选题The 8859-1 character code for the uppercase letter A is 65. Which of these code fragments declare and initialize a variable of type char with this value?()Achar ch = 65;Bchar ch = ’¥65’;Cchar ch = ’¥0041’;Dchar ch = ’A’;Echar ch = A;

多选题package sun.scjp;  public enum Color { RED, GREEN, BLUE }  package sun.beta;  // insert code here  public class Beta {  Color g = GREEN;  public static void main( String[] argv)  { System.out.println( GREEN); }  }  The class Beta and the enum Color are in different packages.  Which two code fragments, inserted individually at line 2 of the Beta declaration, will allow this code to compile?()Aimport sun.scjp.Color.*;Bimport static sun.scjp.Color.*;Cimport sun.scjp.Color; import static sun.scjp.Color.*;Dimport sun.scjp.*; import static sun.scjp.Color.*;Eimport sun.scjp.Color; import static sun.scjp.Color.GREEN;

多选题Given that c is a reference to a valid java.io.Console object,which two code fragments read a line of textfrom the console?()AString s = c.readLine();Bchar[] c = c.readLine();CString s = c.readConsole();Dchar[] c = c.readConsole();EString s = c.readLine(%s, name );

多选题Which two code fragments will execute the method doStuff() in a separate thread?()Anew Thread() { public void run() { doStuff(); } }Bnew Thread() { public void start() { doStuff(); } }Cnew Thread() { public void start() { doStuff(); } } .run();Dnew Thread() { public void run() { doStuff(); } } .start();Enew Thread(new Runnable() { public void run() { doStuff(); } } ).run();Fnew Thread(new Runnable() { public void run() { doStuff(); } }).start();

多选题Which two statements are true about MLP interleaving? ()AIt fragments and encapsulates all packets in a fragmentation header.BPackets smaller than the fragmentation size are interleaved between the fragments of thelarger packets.CPackets larger than the fragmentation size are always fragmented, and cannot be interleaved,even if the traffic is voice traffic.DIt fragments and encapsulates packets that are longer than a configured size, but does not encapsulate smaller packets inside a fragmentation header.

多选题10. public class Bar {  11.static void foo(int...x) {  12. // insert code here  13. }  14. }  Which two code fragments, inserted independently at line 12, will allow the class to compile?()Aforeach(x) System.out.println(z);Bfor(int z : x) System.out.println(z);Cwhile( x.hasNext()) System.out.println( x.next());Dfor( int i=0; i x.length; i++ ) System.out.println(x[i]);

多选题Which two code fragments are most likely to cause a StackOverflowError?()AABBCCDDEEFF

多选题Given: Which four code fragments, inserted independently at line 7, will compile?()Apublic void m1() { }Bprotected void m1() { }Cprivate void m1() { }Dvoid m2() { }Epublic void m2() { }Fprotected void m2() { }