题目详情
当前位置:首页 > 职业培训考试
题目详情:
发布时间:2024-05-16 06:31:20

[单项选择] 现有:   class ThreadExcept implements Runnable {   public void run() { throw new RuntimeException("exception "); }   public static void main(String [] args) {   new Thread(new ThreadExcept()).start();   try {   int x = Integer.parseInt(args[0]);   Thread.sleep(x);   System.out.print("main ");  } catch (Exception e) { }  }   }   和命令行:  java ThreadExcept 1000   哪一个是结果?() 
A.  main
B.  编译失败
C.  代码运行,但没有输出
D.  main java.lang.RuntimeException: exception

更多"现有:   class ThreadEx"的相关试题:

[单项选择] 现有:   class ThreadExcept implements Runnable {   public void run() { throw new RuntimeException("exception "); }  public static void main(String [] args) {   new Thread(new ThreadExcept()).start();   try {   int x = Integer.parseInt(args[0]);   Thread.sleep(x);   System.out.print("main ");    } catch (Exception e) { }      }   }   和命令行:  java ThreadExcept 1000    哪一个是结果?() 
A.  main
B.  编译失败
C.  代码运行,但没有输出
D.  main java.lang.RuntimeException: exception
[单项选择] Your company network has implemented a terminal server farm named TSFARM1. The farm consists offive computers running Windows Server 2008, including a server named TSLB1 on which the TS SessionBroker role service is installed. You want to add a sixth computer running Windows Server 2008, named TSLB6, to the farm. After configuring the server with the same hardware and software options as those of the other farm members,you join TSLB6 to the farm by specifying TSLB1 as the TS Session Broker Server and TSFARM1 as thefarm name in the TS Session Broker properties on TSLB6. You verify that some users who attempt toconnect to the virtual server name TSFARM1 are able to establish Terminal Services sessions on TSLB6,but these users are not able to reconnect to disconnected sessions. You want users connecting to TSLB6through TSFARM1 to be able to reconnect to disconnected RDP sessions. What should you do?()
A. Add TSLB6 to the Session Directory Computers local group on TSLB6.
B. Add TSLB6 to the Session Directory Computers local group on TSLB1.
C. In the DNS server, add a Host (A) record named TSFARM1 that maps to the IP address of TSLB6.
D. In the DNS server, add a Host (A) record named TSLB6 that maps to the IP address of TSLB6.
[单项选择] 现有      public class Parentt      public void change (int x){)     )      public class Child extends Parent{     //覆盖父类change方法     }      下列哪个声明是正确的覆盖了父类的change方法?()    
A.   protected void change (int x){}
B.   public void change(int x,  int y){}
C.   public void change (int x){}
D.   public void change (String s){}
[单项选择] 现有:      1  Interface F{}  2  class A implements F{}      3  class B extends A{}      4  class C extends B{  5    public static void main(String[]  args){      6    B b=new B();  7    //inSert C0de here      8    }      9    } 下列哪行代码插入到第7行,将抛出java.lang.ClassCaseException异常()
A.    A a=b;
B.   F f=  (C)b;
C.   F f=  (A)b;
D.   B bb=  (B)(A)b;
[单项选择] 现有:     class Pencil  {  public void write (String content){     System.out.println ("Write"+content);     }     }  class RubberPencil extends Pencil{     public void erase (String content){     System.out.println ("Erase"+content);     }     }  执行下列代码的结果是哪项?()      Pencil pen=new RubberPencil();      pen.write ("Hello");      pen.erase ("Hello");    
A.  Write Hello        Erase Hello
B.  Erase Hello        Write Hello
C. 编译错误
D. 运行时抛出异常
[多项选择] 现有   1. class Calc {  2.  public static void main(String [] args) {   3.    try {  4.         int x = Integer.parselnt ("42a") ;   5.     //insert code here  6.         System.out.print ("oops");   7.    }   8.   }   9. }   下面哪两行分别插入到第五行,会导致输 "oops" ? () 
A.  } catch (IllegalArgumentException e) {
B.  } catch (IllegalStateException c) {
C.  } catch (NumbelFormatException n) {
D.  } catch (ClassCastException c) {
[单项选择] 现有:  interface  I  {  void go();  }      abstract class A implements I { }      class C extends A  {     void go(){ }     }  结果是什么?()   
A. 代码通过编译
B. 由于第1行的错误导致编译失败
C. 由于笫3行的错误导致编译失败
D. 由于第6行的错误导致编译失败
[单项选择] 现有:      class TestA  {  public void start()  {  System.out.println("TestA");  }     }  public class TestB extends TestA  {  public void start()  {  System.out.println("TestB");  }     public static void main (string[]  args)  (     ((TestA)new TestB()).start();     )     }  运行结果是哪项?()     
A.   TeStA
B.   TeStB
C. 编译失败
D. 运行时抛出异常
[单项选择] 现有:      class Pencil  {  public void write (String content){     System.out.println( "Write",+content){     }     }class RubberPencil extends Pencil{     public void write (String content){  System.out.println("Rubber Write"+content);     }  public void erase (String content)}}  执行下列代码的结果是哪项?()      Pencil  pen=new  Pencil();  (( RubberPencil) pen).write( "Hello");    
A. Write Hello
B. Rubber Write Hello
C. 编译失败
D. 运行时抛出异常
[单项选择] 现有:  class  Ifs  {  public  static void main (String  []  args)  {      boolean state=false;      int i=2;  if( (++i>2)  &&  (state=true))     i++;  if( (++i>4)  l l  (state=false))      i++;  System.out .println (i);     }     } 结果为:()     
A.   6
B.   5
C.   4
D. 编译失败
[单项选择] 现有:  class  Test4  {  public static void main (String  []  args)  {    boolean X=true;   boolean y=false;    short Z=42;    if((z++==42)  &&  (y=true))z++;    if((x=false)  ||    (++z==45))  z++;    System. out.println(¨z=”+z);     }    }  结果为:() 
A.   Z=42
B.   z=44
C.   Z= 45
D.   z= 46
[单项选择] 现有:      class Test2  f  public  static void main (String  []  args)  {      short a,b,C;      a=l;      b=2;  C=a+b;      a+=2:      }        以上代码中,哪一句是错误的?()     
A. a=1:
B. C=a+b;
C. a+=2;
D. short a,b,C;
[多项选择] 现有:  class HorseRadish  {      //insert code here  protected HorseRadish (int x)    {      System.out.println ("bok choy");      }      }  class Wasabi extends HorseRadish  {  public static void main (String  []  args){    Wasabi w- new Wasabi();     }     }  分别插入到第2行,哪两项允许代码编译并产生”bok choy”输出结果()
A.  protected HorseRadish()  {this (42);}
B.   protected HorseRadish()  {}
C.   //just a comment
D.   protected  HorseRadish()  {  new HorseRadish (42);}
[单项选择] 现有代码片段:      String  s="123";      String sl=S+456;  请问sl的结果是哪项?()     
A.  123456
B.  579
C. 编译错误
D. 运行时抛出异常
[单项选择] 现有:  class Top  {     static int X=l;  public Top()  {  x*=3; }     }  class Middle extends Top  {      public  Middle()    {x+=l;  }  public static void main(String  []  args)  {     Middle m=new Middle();    System.out.println (x);    }     }  结果是什么?()    
A.   2
B.   3
C.   4
D. 编译失败
[单项选择] 现有:      class Cat  {      Cat (int c)  {System.out.print {"cat"+c+" ");  }      }      class SubCat extends Cat  {      SubCat (int c){super (5); System.out.print ("cable");}      SubCat()  {  this (4);  }      public static void main (String  []  args)  {      SubCat s= new SubCat();      }      }     结果为:()     
A.  cat5
B.  cable
C.  cat5 cable
D.  cable cat5
[单项选择] 现有:  class Guy  {  String greet()  {  return "hi";  } } class Cowboy extends Guy  {  String greet()  {  return. "howdy";}}  class  Wrangler  extends  Cowboy  {  String  greet()  {  return  "orch!"; } }  class Greetings2  {  public  static void main (String  []  args)  {  Guy g=new Wrangler();  Guy g2=new Cowboy();  Wrangler w2=new Wrangler();  System. out .print (g.greet()+g2.greet()+w2 .greet());  }  }  结果是什么?()     
A.  hi hi ouch!
B.  ouch!  howdy  ouch!
C.  hi howdy ouch!
D. 编译失败
E. 运行的咐候有异常抛出

我来回答:

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

订单号:

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