首页 试题详情
单选题

给定以下JAVA代码,这段代码编译运行后输出的结果是( ?)。???public class Test {???????public static int aMethod(int i) throws Exception ???{??? ?try{return i/10;}catch(Exception ex){throw new Exception (exception in a aMothod);}finally{?? ? System.out.print(finally);}}??? ?public static void main(String []?args) ?{try{aMethod(0);??? }catch(Exception ex){System.out.print(exception in main);??? }System.out.print(finished);}}

Afinally?out?exception in mainfinished

Bexception in mainfinally

Cfinally finished

Dfinally exception in mainfinished

正确答案:A (备注:此答案有误)

相似试题

  • 单选题

    给定以下JAVA代码代码编译运行输出的结果是( ?)。???public class Test {???????public static int aMethod(int i) throws Exception ???{??? ?try{return i/10;}catch(Exception ex){throw new Exception (exception in a aMothod);}finally{?? ? System.out.print(finally);}}??? ?public static void main(String []?args) ?{try{aMethod(0);??? }catch(Exception ex){System.out.print(exception in main);??? }System.out.print(finished);}}

    答案解析

  • 单选题

    Java虚拟机(JVM)运行Java代码时,不会进行的操作是:

    答案解析

  • 单选题

    Java中,如下代码创建一个新线程并启动线程: Runnable target=new MyRunnable(); Thread myThread=new Thread(target); 问:以下哪个类可以创建target对象,并能编译正确?

    答案解析

  • 单选题

    在JavaEE中,给定某Servlet的代码如下,编译运行该文件,以下陈述正确的是( )。public class Servlet1 extends HttpServlet{  public void init() throws ServletException{ }  public void service (HttpServletRequest request,HttpServletResponse response)Throws ServletException,IOException{    PrintWriter out = response.getWriter();    out.println(“Hello World JSP!”);  }}

    答案解析

  • 单选题

    云计算新课2-以下代码编译时会报错的是

    答案解析

热门题库