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


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

QUESTION NO 116
Given:
1. public class Test {
2. public static void main (String []args) {
3. unsigned byte b = 0;
4. b--;
5.
6. }
7. }
What is the value of b at line 5?
A. -1
B. 255
C. 127
D. Compilation will fail.
E. Compilation will succeed but the program will throw an exception at line 4.
Answer: D
QUESTION NO 117
Given:
1. public class Foo {
2. public void main (String [] args) {
3. system.out.printIn(“Hello World.”);
4. }
5. }
What is the result?
A. An exception is thrown.
B. The code does no compile.
C. “Hello World.” Is printed to the terminal.
D. The program exits without printing anything.
Answer: A
QUESTION NO 118
Given:
1. //point X
2. public class foo (
3. public static void main (String[]args) throws Exception {
4. java.io.printWriter out = new java.io.PrintWriter (
5. new 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.*;
B. Include java.io.*;
C. Import java.io.PrintWriter;
D. Include java.io.PrintWriter;
E. No statement is needed.
Answer: E
QUESTION NO 119
Which will declare a method that is available to all members of the same package and can be referenced
without an instance of the class?
A. Abstract public void methoda();
B. Public abstract double methoda();
C. Static void methoda(double d1){}
D. Public native double methoda() {}
E. Protected void methoda(double d1) {}
Answer: C
QUESTION NO 120
Which type of event indicates a key pressed on a java.awt.Component?
A. KeyEvent
B. KeyDownEvent
C. KeyPressEvent
D. KeyTypedEvent
E. KeyPressedEvent
Answer: A
QUESTION NO 121
Exhibit:
1. import java.awt.*;
2.
3. public class X extends Frame {
4. public static void main (String [] args) {
5. X x = new X();
6. x.pack();
7. x.setVisible(true);
8. }
9.
10. public X() {
11. setLayout (new BordrLayout());
12. Panel p = new Panel ();
13. add(p, BorderLayout.NORTH);
14. Button b = new Button (“North”);
15. p.add(b):
16. Button b = new Button (“South”);
17. add(b1, BorderLayout.SOUTH):
18. }
19. }
Which two statements are true? (Choose Two)
A. The buttons labeled “North” and “South” will have the same width.
B. The buttons labeled “North” and “South” will have the same height.
C. The height of the button labeled “North” can very if the Frame is resized.
D. The height of the button labeled “South” can very if the Frame is resized.
E. The width of the button labeled “North” is constant even if the Frame is resized.
F. The width of the button labeled “South” is constant even if the Frame is resized.
Answer: B, E
QUESTION NO 122
How can you create a listener class that receives events when the mouse is moved?
A. By extending MouseListener.
B. By implementing MouseListener.
C. By extending MouseMotionListener.
D. By implementing MouseMotionListener.
E. Either by extending MouseMotionListener or extending MouseListener.
F. Either by implementing MouseMotion Listener or implementing MouseListener.
Answer: D

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

责任编辑:小草

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