题目详情
当前位置:首页 > 职业培训考试
题目详情:
发布时间:2024-05-13 22:21:33

[单选题]阅读下列程序片段 public void test(){   try{     sayHello();     System.out.println("Hello");   }catch (ArrayIndexOutOfBoundException e) {     System.out.println("ArrayIndexOutOfBoundException");   }catch(Exception e){     System.out.println("Exception");   }finally {     System.out.println("Finally");   } } 如果sayHello( )方法正常运行,则test( )方法的运行结果将是:
A.Hello
B.ArrayIndexOutOfBondsException
C.Exception   Finally
D.Hello  Finally

更多"[单选题]阅读下列程序片段 public void test(){ "的相关试题:

[单选题]现有C#方法定义为public void function1(int parameter1) {…省略…},在该方法中可使用的return语句正确格式是()
A.return 1;
B.return parameter1;
C.return function1;
D.return;
[单选题]给出下列的代码,哪行在编译时可能会有错误? ① public void modify() { ② int i, j, k; ③ i = 100; ④ while ( i > 0 ) { ⑤ j = i * 2; ⑥ System.out.println (" The value of j is " + j ); ⑦ k = k + 1; ⑧ } ⑨ }
A.line 4
B.line 6
C.line 7
D.line 8
[单选题]已知: class A { public final void m() { System.out.println(“A.m”); } } public class B extends A { public void m() { System.out.println(“B.m”); super.m(); } public static void main(String [] args) { new B().m(); } } 那么结果为?
A.A.m
B.B.m
C.B.m A.m
D.编译错误
[单选题]阅读下列程序 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.public abstract class Animal{   public void speak();}
B.public abstract class Animal{   public void speak(){}}
C.public class Animal{   public abstract void speak();}
D.public abstract class Animal{   public abstract void speak(){}}
[单选题]计算机病毒是一种程序片段,通常它隐藏 在().
A.A:计算机的CPU 中
B.B:计算机的内存 储器中
C.C:磁盘的所有文 件中
D.D:可执行文 件中
[单选题]若有以下程序片段: char str[ ]="ab\n\012\\\""; printf("%d",strlen(str)); 上面程序片段的输出结果是 ( )。
A.3
B.4
C.6
D.12
[单选题]请读程序片段(字符串内没有空格): printf("%d\n",strlen("ATS\n012\1\\"));的输出结果是()。
A.11
B.10
C.9
D.8
[单选题]程序片段:在TC20中, int i=65536; printf("%d\n",i);的输出结果是()。
A.65536
B.0
C.有语法错误,无输出结果
D.-1
[单选题]阅读下列代码片段 class InterestTest________ActionListener{ public void actionPerformed (ActionEvent event) { double interest = balance * rate/100; balance += interest; number Format format =Number Format.getCurrencyInstance (); System.out.printlb{"balance = "+Formatter.format (balance)}; } private double rate; } 在下划线处,应填的正确选项是:
A.Implementation
B.Inneritance
C.implements
D.extends
[单选题]下面的程序创建了一个文件输出流对象,用来向文件test.txt中输出数据,假设程序当前目录下不存在文件test.txt,编译下面的程序Test.java后,将该程序运行3次,则文件test.txt 的内容是( )。 import java.io.*; public class Test { public static void main(String args[]) { try { String s="ABCDE"; byte b[]=s.getBytes(); FileOutputStream file=new FileOutputStream("test.txt",true); file.write(b); file.close(); }catch(IOException e) { System.out.println(e.toString()); } } }
A.ABCABC
B.ABCDE
C. Test
D.ABCDE ABCDE ABCDE
[单选题]下列程序的输出结果是: 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{   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.以上都不对

我来回答:

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

订单号:

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