多选题Given the following code, which code fragments, when inserted at the indicated location, will succeed in making the program display a button spanning the whole window area?()   import java.awt.*;   public class Q1e65 {   public static void main(String args[]) {   Window win = new Frame();   Button but = new Button("button");   // insert code fragment here  win.setSize(200, 200);   win.setVisible(true);   }   }Awin.setLayout(new BorderLayout()); win.add(but);Bwin.setLayout(new GridLayout(1, 1)); win.add(but);Cwin.setLayout(new BorderLayout()); win.add(but, BorderLayout.CENTER);Dwin.add(but);Ewin.setLayout(new FlowLayout()); win.add(but);

多选题
Given the following code, which code fragments, when inserted at the indicated location, will succeed in making the program display a button spanning the whole window area?()   import java.awt.*;   public class Q1e65 {   public static void main(String args[]) {   Window win = new Frame();   Button but = new Button("button");   // insert code fragment here  win.setSize(200, 200);   win.setVisible(true);   }   }
A

win.setLayout(new BorderLayout()); win.add(but);

B

win.setLayout(new GridLayout(1, 1)); win.add(but);

C

win.setLayout(new BorderLayout()); win.add(but, BorderLayout.CENTER);

D

win.add(but);

E

win.setLayout(new FlowLayout()); win.add(but);


参考解析

解析: 暂无解析

相关考题:

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

Given:Which exception or error will be thrown when a programmer attempts to run this code?() A.java.lang.StackOverflowErrorB.java.lang.IllegalStateExceptionC.java.lang.ExceptionInInitializerErrorD.java.lang.ArrayIndexOutOfBoundsException

According to STCW Code,which of the following functions must an engineer officer possess?( )

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.

In HDLC Protocol, when Supervisory Frame's type code is '00'.About the following statements, which is correct.A.Receive ReadyB.Receive not ReadyC.RejectD.Selective Reject

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

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.

If a vessel subject to PSC inspection, PSC Officer shall give the inspection to the Captain, the given timeframe for rectification of each deficiency is commonly given in a coded form which called “action code”, which code listed below is used for indication of detention of the vessel?()A、10B、30C、17D、16

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

Given the following code:     public class Person{     int arr[] = new int[10];  public static void main(String a[]) {     System.out.println(arr[1]);     }     }  Which statement is correct?() A、 When compilation some error will occur.B、 It is correct when compilation but will cause error when running.C、 The output is zero.D、 The output is null.

Which code fragments will succeed in printing the last argument given on the command line to the standard output, and exit gracefully with no output if no arguments are given?()   CODE FRAGMENT a:   public static void main(String args[]) {   if (args.length != 0)   System.out.println(args[args.length-1]);   }   CODE FRAGMENT b:   public static void main(String args[]) {   try { System.out.println(args[args.length]); }   catch (ArrayIndexOutOfBoundsException e) {}   }   CODE FRAGMENT c:   public static void main(String args[]) {   int ix = args.length;   String last = args[ix];   if (ix != 0) System.out.println(last);   }   CODE FRAGMENT d:   public static void main(String args[]) {   int ix = args.length-1;   if (ix  0) System.out.println(args[ix]);   }   CODE FRAGMENT e:   public static void main(String args[]) {   try { System.out.println(args[args.length-1]);  }catch (NullPointerException e) {}   }  A、Code fragment a.B、Code fragment b.C、Code fragment c.D、Code fragment d.E、Code fragment e.

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.

Given that c is a reference to a valid java.io.Console object,which two code fragments read a line of textfrom 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 ");

单选题If a vessel subject to PSC inspection, PSC Officer shall give the inspection to the Captain, the given timeframe for rectification of each deficiency is commonly given in a coded form which called “action code”, which code listed below is used for indication of detention of the vessel?()A10B30C17D16

单选题Which code fragments will succeed in printing the last argument given on the command line to the standard output, and exit gracefully with no output if no arguments are given?()   CODE FRAGMENT a:   public static void main(String args[]) {   if (args.length != 0)   System.out.println(args[args.length-1]);   }   CODE FRAGMENT b:   public static void main(String args[]) {   try { System.out.println(args[args.length]); }   catch (ArrayIndexOutOfBoundsException e) {}   }   CODE FRAGMENT c:   public static void main(String args[]) {   int ix = args.length;   String last = args[ix];   if (ix != 0) System.out.println(last);   }   CODE FRAGMENT d:   public static void main(String args[]) {   int ix = args.length-1;   if (ix  0) System.out.println(args[ix]);   }   CODE FRAGMENT e:   public static void main(String args[]) {   try { System.out.println(args[args.length-1]);  }catch (NullPointerException e) {}   }ACode fragment a.BCode fragment b.CCode fragment c.DCode fragment d.ECode fragment e.

多选题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 the following code:     public class Person{ static int arr[] = new int[10];  public static void main(String a[]) {     System.out.println(arr[1];)     }     }  Which statement is correct?()A When compilation some error will occur.B It is correct when compilation but will cause error when running.C The output is zero.D The output is null.

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

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

单选题Given this method in a class:  public String toString() {  StringBuffer buffer = new StringBuffer();  buffer.append(‟‟);  return buffer.toString();  }  Which is true?()A This code is NOT thread-safe.B The programmer can replace StringBuffer with StringBuilder with no other changes.C This code will perform well and converting the code to use StringBuilder will not enhance the performance.D This code will perform poorly. For better performance, the code should be rewritten: return ““+ this.name + “”;

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

单选题Given the following code:     public class Person{     int arr[] = new int[10];  public static void main(String a[]) {     System.out.println(arr[1]);     }     }  Which statement is correct?()A When compilation some error will occur.B It is correct when compilation but will cause error when running.C The output is zero.D The output is null.

多选题You work as an application developer at Certkiller .com. You have recently created an application domain for Certkiller .com. A few weeks later you are asked to retrieve information from this application domain, which is the current application domain. What can you do to achieve this objective?()AUse the following code: AppDomain appInfo = ApplicationDomain.Current;BUse the following code: AppDomain appInfo = AppDomain.CurrentDomain ();CUse the following code: AppDomain appInfo = Thread.GetDomain ();DUse the following code: AppDomain appInfo = MainThread.GetDomain ();

多选题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() { }