题目详情
当前位置:首页 > 职业培训考试
题目详情:
发布时间:2024-06-10 06:33:45

[单项选择] 现有:  class Top  {  static int x=l;  public Top (inty)  {  x*=3;  }      }  class Middle extends Top {      public Middle()  {x+=1;  )  public  static void main (String  []  args)  {      Middle m = new Middle();      System. out .println (x);      }     }      结果为:()     
A. 1
B. 2
C. 3
D. 编译失败

更多"现有:  class Top &ensp"的相关试题:

[单项选择] class TestMain {   static int x = 2;   static { x = 4; }   static public void main(String[] args) {   int y = x + 1;   System.out.println(y);  }  }   和命令行:   java TestMain   结果为:()
A.  3
B.  5
C.  编译失败
D.  运行时异常被抛出
[单项选择] class Mineral {   static String shiny() { return "1"; }   }   class Granite extends Mineral {   public static void main(String [] args) {   String s = shiny() + getShiny();   s = s + super.shiny();   System.out.println(s);   }   static String getShiny() { return shiny(); }   }   结果为:()  
A. 3
B. 12
C. 111
D. 编译失败
[单项选择] class Bird {  static void talk() { System.out.print("chirp "); }  }  class Parrot extends Bird {  static void talk() { System.out.print("hello "); }  public static void main(String [] args) {  Bird [] birds = {new Bird(), new Parrot()};  for( Bird b : birds)  b.talk();  }  }  结果为:() 
A. chirp chirp
B. chirp hello
C. hello hello
D. 编译失败
[单项选择] Given:   11. static class A {   12. void process() throws Exception { throw new Exception(); }   13. }   14. static class B extends A {   15. void process() { System.out.println("B "); }   16. }   17. public static void main(String[] args) {   18. A a = new B();   19. a.process();   20. }   What is the result? ()
A.  Compilation fails because of an error in line 19.
B.  An exception is thrown at runtime.
C.  B
D.  Compilation fails because of an error in line 18.
E.  Compilation fails because of an error in line 15. 
F.  The code runs with no output.
[单项选择] class Top {  static int x = 1;  public Top(int y) { x *= 3; }  }  class Middle extends Top {  public Middle() { x += 1; }  public static void main(String [] args) {  Middle m = new Middle();  System.out.println(x);  }  }  结果为:() 
A. 1
B. 2
C. 3
D. 编译失败
[单项选择] public static void test(String str) { int check = 4;  if (check = str.length()) {  System.out.print(str.charAt(check -= 1) +“, “);  } else {  System.out.print(str.charAt(0) + “, “);  }  }  and the invocation:  test(”four”);  test(”tee”); test(”to”);  What is the result?() 
A.  r, t, t,
B.  r, e, o,
C.  Compilation fails.
D.  An exception is thrown at runtime.
[单项选择] class DemoApp{  public static void main(String[] args){  int x = 5; int y = ++x + x++; S ystem.out.println(“y=”+y+”,x=”+x);  }  }  以上程序运行后的输出结果是哪项?() 
A. y=10,x=5
B. y=11,x=6
C. y=12,x=7
D. y=11,x=7
[单项选择] public static void search(List list) {  list.clear();  list.add(”b”);  list.add(”a”);  list.add(”c”);  System.out.println(Collections.binarySearch(list, “a”));  }  What is the result of calling search with a valid List implementation?()
A. 0
B. 1
C. a
D. b
E. c
F. The result is undefined.
[单项选择] 11. static classA {  12. void process() throws Exception { throw new Exception(); }  13. }  14. static class B extends A {  15. void process() { System.out.println(”B “); }  16. }  17. public static void main(String[] args) {  18.A a=new B();  19. a.process();  20.}  What is the result?() 
A.  B
B.  The code runs with no output.
C.  An exception is thrown at runtime.
D.  Compilation fails because of an error in line 15.
E.  Compilation fails because of an error in line 18.
F.  Compilation fails because of an error in line 19.
[多项选择] public static void main( String[] args ) {  Integer a = new Integer(10);  Integer b = new Integer(10);  Integer c = a;  int d = 10;  double e = 10.0;  }   Which three evaluate to true?()   
A.  (a == c)
B.  (d == e)
C.  (b == d)
D.  (a == b)
E.  (b == c)
F.  (d == 10.0)
[单项选择] static void test() {  try {  String x=null;  System.out.print(x.toString() +“ “);  }  finally { System.out.print(“finally “); }  }  public static void main(String[] args) {  try { test(); }  catch (Exception ex) { System.out.print(”exception “); }  }  What is the result?() 
A.  null
B.  finally
C.  null finally
D.  Compilation fails.
E.  finally exception
[单项选择] 11. static class A {  12. void process() throws Exception { throw new Exception(); }  13. }  14. static class B extends A {  15. void process() { System.out.println(”B”); }  16. }  17. public static void main(String[] args) {  18. new B().process();  19. }  What is the result?() 
A.  B
B.  The code runs with no output.
C.  Compilation fails because of an error in line 12.
D.  Compilation fails because of an error in line 15.
E.  Compilation fails because of an error in line 18.
[单项选择] 11. public static void append(List list) { list.add(”0042”); }  12. public static void main(String[] args) {  13. List intList = new ArrayList();  14. append(intList);  15. System.out.println(intList.get(0));  16. }  What is the result?() 
A.  42
B.  0042
C.  An exception is thrown at runtime.
D.  Compilation fails because of an error in line 13.
E.  Compilation fails because of an error in line 14.
[单项选择] class Passer {  static final int x = 5;  public static void main(String [] args) { new Passer().go(x);  System.out.print(x);  }  void go(int x) {  System.out.print(++x);  }  }  结果是什么?() 
A. 55
B. 56
C. 65
D. 66
[单项选择] Given that a static method doIt() in a class Work represents work to be done, what block of code will succeed in starting a new thread that will do the work?   CODE BLOCK a:   Runnable r = new Runnable() {   public void run() {   Work.doIt();   }   };   Thread t = new Thread(r);   t.start();   CODE BLOCK b:   Thread t = new Thread() {  public void start() {   Work.doIt();  }  };   t.start();   CODE BLOCK c:   Runnable r = new Runnable() {   public void run() {   Work.doIt();   }   };   r.start();  CODE BLOCK d:   Thread t = new Thread(new Work());   t.start();   CODE BLOCK e:   Runnable t = new Runnable() {   public void run() {   Work.doIt();   }   };   t.run();  
A. Code block a.
B. Code block B.
C. Code block c.
D. Code block d.
E. Code block e.
[单项选择] public static Iterator reverse(List list) {  Collections.reverse(list);  return list.iterator();  }  public static void main(String[] args) {  List list = new ArrayList();  list.add(” 1”); list.add(”2”); list.add(”3”);  for (Object obj: reverse(list))  System.out.print(obj + “,”);  }  What is the result?() 
A.  3,2,1,
B.  1,2,3,
C.  Compilation fails.
D.  The code runs with no output.
E.  An exception is thrown at runtime.
[单项选择] 11. public static void test(String str) {  12. if(str == null | str.lellgth() == 0) {  13. System.out.println(”String is empty”);  14. } else {  15. System.out.println(”String is not empty”);  16. }  17. }  And the invocation:  31. test(llull);  What is the result?() 
A.  Au exception is thrown at runtime.
B.  “String is empty” is printed to output.
C.  Compilation fails because of au error in line 12.
D.  “String is not empty” is printed to output.
[单项选择] 11. public static void main(String[] args) {  12. Integer i = uew Integer(1) + new Integer(2);  13. switch(i) {  14. case 3: System.out.println(”three”); break;  15. default: System.out.println(”other”); break;  16. }  17. }  What is the result?() 
A.  three
B.  other
C.  An exception is thrown at runtime.
D.  Compilation fails because of an error on line 12.
E.  Compilation fails because of an error on line 13.
F.  Compilation fails because of an error on line 15.

我来回答:

购买搜题卡查看答案
[会员特权] 开通VIP, 查看 全部题目答案
[会员特权] 享免全部广告特权
推荐91天
¥36.8
¥80元
31天
¥20.8
¥40元
365天
¥88.8
¥188元
请选择支付方式
  • 微信支付
  • 支付宝支付
点击支付即表示同意并接受了《购买须知》
立即支付 系统将自动为您注册账号
请使用微信扫码支付

订单号:

请不要关闭本页面,支付完成后请点击【支付完成】按钮
恭喜您,购买搜题卡成功
重要提示:请拍照或截图保存账号密码!
我要搜题网官网:https://www.woyaosouti.com
我已记住账号密码