多项选择题

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


您可能感兴趣的试卷

你可能感兴趣的试题

1.单项选择题Which statements concerning the effect of the statement gfx.drawRect(5, 5, 10, 10) are true, given that gfx is a reference to a valid Graphics object?()  

A.The rectangle drawn will have a total width of 5 pixels.
B.The rectangle drawn will have a total height of 6 pixels.
C.The rectangle drawn will have a total width of 10 pixels.
D.The rectangle drawn will have a total height of 11 pixels.

5.多项选择题Which of these statements concerning the collection interfaces are true?()  

A.Set extends Collection.
B.All methods defined in Set are also defined in Collection.
C.List extends Collection.
D.All methods defined in List are also defined in Collection.
E.Map extends Collection.

7.多项选择题Which statements describe guaranteed behavior of the garbage collection and finalization mechanisms?()  

A.Objects are deleted when they can no longer be accessed through any reference.
B.The finalize() method will eventually be called on every object.
C.The finalize() method will never be called more than once on an object.
D.An object will not be garbage collected as long as it is possible for an active part of the program to      access it through a reference.
E.The garbage collector will use a mark and sweep algorithm.

8.多项选择题Which statements concerning the value of a member variable are true, when no explicit assignments have been made?()  

A.The value of an int is undetermined.
B.The value of all numeric types is zero.
C.The compiler may issue an error if the variable is used before it is initialized.
D.The value of a String variable is "" (empty string).
E.The value of all object variables is null.

10.多项选择题Given two collection objects referenced by col1 and col2,which of these statements are true?()

A.The operation col1.retainAll(col2) will not modify the col1 object.
B.The operation col1.removeAll(col2) will not modify the col2 object.
C.The operation col1.addAll(col2) will return a new collection object, containing elements from both col1      and col2.
D.The operation col1.containsAll(Col2) will not modify the col1 object.