移动端

  • 题王微信公众号

    微信搜“题王网”真题密题、最新资讯、考试攻略、轻松拿下考试

计算机考试 | Java认证考试

科目:

SCJP程序员认证考试

[切换]
考试
资讯

模式切换

0 0 0
我的错题 我的收藏 学习笔记

章节目录

多选题 import java.awt.*;   public class X extends Frame {   public static void main (String args) {   X x = new X();   x.pack();   x.setVisible(true);   }  public X() {   setLayout (new BordrLayout());   Panel p = new Panel ();   add(p, BorderLayout.NORTH);   Button b = new Button (“North”);   p.add(b):   Button b = new Button (“South”);   add(b1, BorderLayout.SOUTH):   }   }   Which two statements are true?()

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.

单选题 public class X {  public static void main (String[]args)  {  String s1 = new String (“true”);  Boolean b1 = new Boolean (true);  if (s2.equals(b1))   {  System.out.printIn(“Equal”);  }  }  }      What is the result?()  

A

 The program runs and prints nothing.

B

 The program runs and prints “Equal”

C

 An error at line 5 causes compilation to fail.

D

 The program runs but aborts with an exception.

多选题 10. class Foo {  11. static void alpha() { /* more code here */ }  12. void beta() { /* more code here */ }  13. }  Which two are true?()

A

 Foo.beta() is a valid invocation of beta().

B

 Foo.alpha() is a valid invocation of alpha().

C

 Method beta() can directly call method alpha().

D

 Method alpha() can directly call method beta().

单选题 package test1;  public class Test1 {  static int x = 42;  }  package test2;  public class Test2 extends test1.Test1 {  public static void main(String[] args) { System.out.println(“x = “ + x);  }  }  What is the result?() 

A

 x = 0

B

 x = 42

C

 Compilation fails because of an error in line 2 of class Test2.

D

 Compilation fails because of an error in line 3 of class Test1.

E

 Compilation fails because of an error in line 4 of class Test2.

单选题 If class Donkey2 is invoked twice, the first time without assertions enabled, and the second time with assertions enabled, what are the results?()

A

no output

B

no output assert is on

C

assert is on

D

no output , An Assertion Error is thrown.

E

assert is on , An AssertionError is thrown.

多选题 Which statements about inheritance are true?()         

A

 In Java programming language only allows single inheritance.

B

 In Java programming language allows a class to implement only one interface.

C

 In Java programming language a class cannot extend a class and implement a interface together.

D

 In Java programming language single inheritance makes code more reliable.

1 2 3 4 5 下一页 尾页 /

到第