高分求解,谢谢拉!过几天就考拉!
35. You are assigned the task of building a panel containing a TextArea at the top, a label directly below it, and a button directly below the label. If the three components are added directly to the panel, which layout manager can the panel use to ensure that the TextArea absorbs all of the free vertical space when the panel is resized?
A. GridLayout
B. CardLayout
C. FlowLayout
D. BorderLayout
E. GridBagLayout
题目的意思能解释下吗?
40. What writes the text “<end>” to the end of the file “file.txt”?
A. OutputStream out= new FileOutputStream (“file.txt”);
Out.writeBytes (“<end>/n”);
B. OutputStream os= new FileOutputStream (“file.txt”, true);
DataOutputStream out = new DataOutputStream(os);
out.writeBytes (“<end>/n”);
C. OutputStream os= new FileOutputStream (“file.txt”);
DataOutputStream out = new DataOutputStream(os);
out.writeBytes (“<end>/n”);
D. OutputStream os= new OutputStream (“file.txt”, true);
DataOutputStream out = new DataOutputStream(os);
out.writeBytes (“<end>/n”);
请问下
OutputStream os=new FileOutputStream("file.txt",true);
DataOutputStream out=new DataOutputStream(os);
out.writeBytes("<end>/n");
与
OutputStream os=new FileOutputStream(new File(file.txt),true);
DataOutputStream out=new DataOutputStream(os);
out.writeBytes("<end>/n");
有什么区别吗?我在机子上试过 ,好象第二个会编译错误,
另外,这里的true 是不是指在数据流os后面可以加入数据流
要是没有这个true ,则“end”不能加入到里面去呢?
111. Given:
1. public class Foo {
2. private int val;
3. public foo(int v) (val = v;) }
4. public static void main (String [] args) {
5. Foo a = new Foo (10);
6. Foo b = new Foo (10);
7. Foo c = a;
8. int d = 10;
9. double e = 10.0;
10. }
11. }
101。Which three logical expressions evaluate to true? (Choose Three)
A.(a ==c)
B.(d ==e)
C.(b ==d)
D.(a ==b)
E.(b ==c)
F.(d ==10.0)
我认为选a,d,e,f
答案选a,b,f
请教
有道题目有分歧!
125 Which two statements are true regarding the creation of a default constructor? (Choose Two)
A. The default constructor initializes method variables.
B. The compiler always creates a default constructor for every class.
C. The default constructor invokes the no-parameter constructor of the superclass.
D. The default constructor initializes the instance variables declared in the class.
E. When a class has only constructors with parameters, the compiler does not create a default constructor.
我觉得D,E对的,E是肯定对的,而D中说默认构造器初始化事例变量也应该是对的啊?答案却认为
c,e是对的!请教高手
Which statement is true?
A. The Error class is a untimeException.
B. No exceptions are subclasses of Error.
C. Any statement that may throw an Error must be enclosed in a try block.
D. Any statement that may throw an Exception must be enclosed in a try block.
E. Any statement that may thro a runtimeException must be enclosed in a try block.
这里我认为没有答案:
a是明显错误的,b中,Error也应该算是一个异常啊,它有子类的啊/
c中Error是未检测异常,所以不需要在try块中
d中当抛出的是未检测异常时就不需要放在try中,e同理
143. Given:
1. public class MethodOver {
2. private int x, y;
3. private float z;
4. public void setVar(int a, int b, float c){
5. x = a;
6. y = b;
7. z = c;
8. }
9. }
Which two overload the setVar method? (Choose Two)
A. void setVar (int a, int b, float c){
x = a;
y = b;
z = c;
}
B. public void setVar(int a, float c, int b) {
setVar(a, b, c);
}
C. public void setVar(int a, float c, int b) {
this(a, b, c);
}
D. public void setVar(int a, float b){
x = a;
z = b;
}
E. public void setVar(int ax, int by, float cz) {
x = ax;
y = by;
z = cz;
}
答案是b,d
d肯定是对的,就是b跟c有什么区别吗?