SCJP考试题310-025(第二套)18-147

来源:java认证发布时间:2012-11-12 13:05:39java认证视频


Question No 13
Given:
1. package foo;
2.
3. public class Outer (
4. public static class Inner (
5. )
6. )
Which statement is true?
A. An instance of the Inner class can be constructed with “new Outer.Inner ()”
B. An instance of the inner class cannot be constructed outside of package foo.
C. An instance of the inner class can only be constructed from within the outer class.
D. From within the package bar, an instance of the inner class can be constructed with “new inner()”
Answer: A
Question No 14
Exhibit:
1. public class enclosingone (
2. public class insideone{}
3. )
4. public class inertest(
5. public static void main (string[]args)(
6. enclosingone eo= new enclosingone ();
7. //insert code here
8. )
9. )
Which statement at line 7 constructs an instance of the inner class?
A. InsideOnew ei= eo.new InsideOn();
B. Eo.InsideOne ei = eo.new InsideOne();
C. InsideOne ei = EnclosingOne.new InsideOne();
D. EnclosingOne.InsideOne ei = eo.new InsideOne();
Answer: D
Question No 15
Exhibit:
1. interface foo {
2. int k = 0;
3. ]
4.
5. public class test implements Foo (
6. public static void main(String args[]) (
7. int i;
8. Test test = new test ();
9. i= test.k;
10.i= Test.k;
11.i= Foo.k;
12.)
13.)
14.
What is the result?
A. Compilation succeeds.
B. An error at line 2 causes compilation to fail.
C. An error at line 9 causes compilation to fail.
D. An error at line 10 causes compilation to fail.
E. An error at line 11 causes compilation to fail.
Answer: A
Question No 16
Given:
1. //point X
2. public class foo (
3. public static void main (String[]args) throws Exception {
4. printWriter out = new PrintWriter (new
5. java.io.outputStreamWriter (System.out), true;
6. out.printIn(“Hello”);
7. }
8. )
Which statement at PointX on line 1 allows this code to compile and run?
A. Import java.io.PrintWriter;
B. Include java.io.PrintWriter;
C. Import java.io.OutputStreamWriter;
D. Include java.io.OutputStreamWriter;
E. No statement is needed.
Answer: A
Question No 17
Which two statements are reserved words in Java? (Choose Two)
A. Run
B. Import
C. Default
D. Implement
Answer: B, C
Question No 18
Which three are valid declarations of a float? (Choose Three)
A. Float foo = -1;
B. Float foo = 1.0;
C. Float foo = 42e1;
D. Float foo = 2.02f;
E. Float foo = 3.03d;
F. Float foo = 0x0123;
Answer: A, D, F

上一页123下一页

视频学习

我考网版权与免责声明

① 凡本网注明稿件来源为"原创"的所有文字、图片和音视频稿件,版权均属本网所有。任何媒体、网站或个人转载、链接转贴或以其他方式复制发表时必须注明"稿件来源:我考网",违者本网将依法追究责任;

② 本网部分稿件来源于网络,任何单位或个人认为我考网发布的内容可能涉嫌侵犯其合法权益,应该及时向我考网书面反馈,并提供身份证明、权属证明及详细侵权情况证明,我考网在收到上述法律文件后,将会尽快移除被控侵权内容。

最近更新

社区交流

考试问答