)92-147/147的文章 name=description>


SCJP考试题310-025(第二套<4>)92-147/147
来源:优易学  2011-9-22 20:30:08   【优易学:中国教育考试门户网】   资料下载   IT书店

QUESTION NO 123
Which statement is true?
A. A grid bag layout can position components such that they span multiple rows and/or columns.
B. The “North” region of a border layout is the proper place to locate a menuBar component in a
Frame.
C. Components in a grid bag layout may either resize with their cell, or remain centered in that cell at
their preferred size.
D. A border layout can be used to position a component that should maintain a constant size even
when the container is resized.
Answer: A
QUESTION NO 124
You want a class to have access to members of another class in the same package. Which is the most
restrictive access modifier that will accomplish that will accomplish this objective?
A. Public
B. Private
C. Protected
D. Transient
E. No access modifier is required.
Answer: E
QUESTION NO 125
Which two statements are true regarding the creation of a default constructor? (Choose Two)
A. The default constructor initializes method variables.
B. The default constructor invokes the no-parameter constructor of the superclass.
C. The default constructor initializes the instance variables declared in the class.
D. If a class lacks a no-parameter constructor,, but has other constructors, the compiler creates a
default constructor.
E. The compiler creates a default constructor only when there are no other constructors for the class.
Answer: C, E
QUESTION NO 126
Given:
1. public class OuterClass {
2. private double d1 1.0;
3. //insert code here
4. }
You need to insert an inner class declaration at line2. Which two inner class declarations are valid?
(Choose Two)
A. static class InnerOne {
public double methoda() {return d1;}
}
B. static class InnerOne {
static double methoda() {return d1;}
}
C. private class InnerOne {
public double methoda() {return d1;}
}
D. protected class InnerOne {
static double methoda() {return d1;}
}
E. public abstract class InnerOne {
public abstract double methoda();
}
Answer: C, E

QUESTION NO 127
Which two declarations prevent the overriding of a method? (Choose Two)
A. Final void methoda() {}
B. Void final methoda() {}
C. Static void methoda() {}
D. Static final void methoda() {}
E. Final abstract void methoda() {}
Answer: A, D
QUESTION NO 128
Given:
1. public class Test {
2. public static void main (String args[]) {
3. class Foo {
4. public int i = 3;
5. }
6. Object o = (Object) new Foo();
7. Foo foo = (Foo)o;
8. System.out.printIn(foo. i);
9. }
10. }
What is the result?
A. Compilation will fail.
B. Compilation will succeed and the program will print “3”
C. Compilation will succeed but the program will throw a ClassCastException at line 6.
D. Compilation will succeed but the program will throw a ClassCastException at line 7.
Answer: B
QUESTION NO 129
Which two create an instance of an array? (Choose Two)
A. int[] ia = new int [15];
B. float fa = new float [20];
C. char[] ca = “Some String”;
D. Object oa = new float[20];
E. Int ia [][] = (4, 5, 6) (1, 2, 3)
Answer: A, D
QUESTION NO 130
Given:
1. public class ExceptionTest {
2. class TestException extends Exception {}
3. public void runTest () throws TestException {}
4. public void test () /* Point X*/ {
5. runTest ();
6. }
7. }
At point X on line 4, which code can be added to make the code compile?
A. Throws Exception.
B. Catch (Exception e).
C. Throws RuntimeException.
D. Catch (TestException e).
E. No code is necessary.
Answer: B

上一页  [1] [2] [3] [4] [5] [6] [7] [8] 下一页

责任编辑:小草

文章搜索:
 相关文章
热点资讯
资讯快报
热门课程培训