Which two code fragments correctly create and initialize a s

题目
多选题
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;}

如果没有搜索结果或未解决您的问题,请直接 联系老师 获取答案。
相似问题和答案

第1题:

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

第2题:

Given: 3.public class MyTagHandler extends TagSupport { 4.public int doStartTag() { 5.// insert code here 6.// return an int 7.} 8.// more code here ... 18.} There is a single attribute foo in the session scope. Which three code fragments,inserted independently atline 5,return the value of the attribute?()

  • A、Object o = pageContext.getAttribute("foo");
  • B、Object o = pageContext.findAttribute("foo");
  • C、Object o = pageContext.getAttribute("foo",PageContext.SESSION_SCOPE);
  • D、HttpSession s = pageContext.getSession();Object o = s.getAttribute("foo");

正确答案:B,C,D

第3题:

You create a Web application for your company‘s intranet. You want to enable users to customize their versions of the intranet home page. You create sections of content as Web Parts. You need to ensure that users can customize content at any time.Which two code segments should you use?()

A.

B.

C.

D.


参考答案:B, C

第4题:

WebSphere Commerce Accelerator will be used to create a product. The product has 6 variations determined by attributes Size, which has three values and Color, which has two values. What is the PREFERRED method to create the product and its SKUs using the Product Management tool?()

  • A、Create the product. Create each SKU. For each SKU create two descriptive attributes with the correct values.
  • B、Create the product. Create two defining attributes. Create each SKU and during creation assign theattributes to the SKU with the correct values.
  • C、Create the product. Create two defining attributes with the permitted values. Generate the SKUs.
  • D、Create the product. Create two descriptive attributes with the permitted values. Generate the SKUs.

正确答案:C

第5题:

In your web application,you need to execute a block of code whenever the session object is first created. Which design will accomplish this goal?()

  • A、Create an HttpSessionListener class and implement the sessionInitialized method with that block ofcode.
  • B、Create an HttpSessionActivationListener class and implement the sessionCreated method with thatblock of code.
  • C、Create a Filter class, call the getSession(false) method, and if the result was null, then execute that block of code.
  • D、Create an HttpSessionListener class and implement the sessionCreated method with that block of code.

正确答案:D

第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题:

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;}


参考答案:A, B

第9题:

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?()

  • A、String s = c.readLine();
  • B、char[ ] c = c.readLine();
  • C、String s = c.readConsole();
  • D、char[ ] c = c.readConsole();
  • E、String s = c.readLine("%s", "name ");
  • F、char[ ] c = c.readLine("%s", "name ");

正确答案:A,E

第10题:

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";

正确答案:A,D

更多相关问题