Which two code 

题目

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; }
如果没有搜索结果或未解决您的问题,请直接 联系老师 获取答案。
相似问题和答案

第1题:

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.


参考答案:B, E

第2题:

Which two EAP types does the Cisco Unified Wireless IP Phone 7921G firmware code version 1.3(x) support?()

  • A、EAP-TLS
  • B、EAP-TTLS
  • C、EAP-SIM
  • D、PEAPv1/EAP-GTC
  • E、LEAP

正确答案:A,E

第3题:

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 */ }


参考答案:B, C, E

第4题:

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.

正确答案:A,D

第5题:

Which two are characteristics of the Service Locator pattern?()

  • A、It encapsulates component lookup procedures.
  • B、It increases source code duplication and decreases reuse.
  • C、It improves client performance by caching context and factory objects.
  • D、It degrades network performance due to increased access to distributed lookup services.

正确答案:A,C

第6题:

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.


参考答案:A, C

第7题:

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 */ }

正确答案:B,C,E

第8题:

Given:Which two changes, taken together, would guarantee the output: 1, 2, 3, 4, 5, ?()

A.move the line 12 print statement into the foo() method

B.change line 7 to public synchronized void go() {

C.change the variable declaration on line 2 to private volatile int x;

D.wrap the code inside the foo() method with a synchronized( this ) block

E.wrap the for loop code inside the go() method with a synchronized block synchronized(this){ //for loop code here }


参考答案:A, D

第9题:

You are creating a new JSP page and you need to execute some code that acts when the page is firstexecuted, but only once. Which three are possible mechanisms for performing this initialization code?()

  • A、In the init method.
  • B、In the jspInit method.
  • C、In the constructor of the JSP’s Java code.
  • D、In a JSP declaration, which includes an initializer block.
  • E、In a JSP declaration, which includes a static initializer block.

正确答案:B,D,E

第10题:

Which the two are characteristics of the Service Locator pattern?()

  • A、 It encapsulates component lookup procedures
  • B、 It increases source code duplication and decreases reuse
  • C、 It improves client performance by caching context and factory objects
  • D、 It degrades network performance due to increased access to distributed lookup services

正确答案:A,C

更多相关问题