题目详情
当前位置:首页 > 职业培训考试
题目详情:
发布时间:2023-11-08 04:40:30

[单选题]下列程序的运行结果是: public class test{   private String[] data={"10","10.5"};   public void fun(){     double s=0;     for(int i=0;i<3;i++){       try{         s=s+Integer .parseInt(data[i]);       }catch(Exception e{         System.out.print("errorl:"+data[i]);       }     }   }   public static void main(String[]args){     try{       test d=new test();       d .fun();     }catch(Exception e){       System.out.println("error2");     }   } }
A.errorl:10.5
B.error2
C.errorl:10.5 error2
D.以上都不对

更多"[单选题]下列程序的运行结果是: public class test{"的相关试题:

[单选题]下列程序的运行结果是: public class test{   private String[] data={"10","10.5"};   public void fun(){     double s=0;     for(int i=0;i<3;i++){       try{         s=s+Integer .parseInt(data[i]);       }catch(Exception e{         System.out.print("errorl:"+data[i]);       }     }   }   public static void main(String[]args){     try{       test d=new test();       d .fun();     }catch(Exception e){       System.out.println("error2");     }   } }
A.errorl:10.5
B.error2
C.errorl:10.5 error2
D.以上都不对
[单选题]下列程序的输出结果是: public class Test{   public static void main(String[] args){     int [] array={2,4,6,8,10};     int size=6;     int result=-1;     try{       for(int i=0;iA.Catch---1
B.Catch---2
C.Catch---3
D.以上都不对
[单选题]下列代码的执行结果是 public class Test { public int aMethod() { static int i=0; i++; System.out.println(i); } public static void main(String args[]) { Test test = new Test(); test.aMethod(); } }
A.编译错误
B.0
C.1
D.运行成功,但不输出
[单选题]下列代码的执行结果是: public class Test { public static void main(String[] args) { int[] x={0,1,2,3}; for(int i=0;i<3;i+=2){ try{ System.out.println(x[i+2]/x[i]+x[i+1]); }catch(ArithmeticException e){ System.out.println("error1"); }catch(Exception e){ System.out.println("error2"); } } } }
A.error1
B.error2
C.error1 error2
D.2 error2
[单选题]阅读下列程序 public class Test implements Runnable{   private int x=0;   private int y=o;   boolean flag=true;   public static void main(string[ ] args) {     Test r =new Test( );     Thead t1=new Thead(r);     Thead t2=new Thead(r);     t1.start( );     t2.start( );   }   public void run(){     while(flag) {       x++;       y++;       System.out.println("(" +x_ ","+y+")");       if (x>=10)         flag=false;     }   } } 下列对程序运行结果描述的选项中,正确的是:
A.每行的(x,y)中,可能有;每一对(x,y)值都出现两次。
B.每行的(x,y)中,可能有;每一对(x,y)值仅出现一次。
C.每行的(x,y)中,可能有x=y;每一对(x,y)值都出现两次。
D.每行的(x,y)中,可能有x=y;每一对(x,y)值都出现一次。
[单选题]以下程序运行结果是( ) $
A.vbscript
B.is
C.good
D.*
[单选题]在程序的下划线处应填入的选项是: public class Test_____{   public static void main(String args[]){     Test t = new Test();     Thread tt = new Thread(t);     tt.start();   }   public void run(){     for(int i=0;i<5;i++){       System.out.println("i="+i);     }   } }
A.implements Runnable
B.extends Thread
C.implements Thread
D.extends Runnable
[单选题]阅读下列代码段 class Test implements Runnable { public int run( ) { int i = 0; while (true) { i++; System.out.println ("i="+i); } } } 上述代码的编译结果是:
A.程序通过编译并且run ()方法可以正常输出递增的i值
B.程序通过编译,调用run ()方法将不显示任何输出
C.程序不能通过编译,因为while的循环控制条件不能为“true”
D.程序不能通过编译,因为run ()方法的返回值类型不是void
[单选题]以下程序运行后的输出结果是 ( ) 。 #include main() {int n[2],i,j; for(i=0;i<2;i++) n[i]=0; for(i=0;i<2;i++) for(j=0;j<2;j++) n[j]=n[i]+1; printf(“%d\n”,n[1]); }
A.4
B.3
C.2
D.1
[单选题]以下程序运行后的输出结果是() 。   #include   main()   { int x=10,y=20,t=0;   if(x==y)t=x;x=y;y=t;   printf("%d %d\n",x,y);   }
A.10 0
B.20 0
C.10 20
D.20 10

我来回答:

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

订单号:

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