zoukankan      html  css  js  c++  java
  • 面试异常的趣味题,欢迎来战!!!!!

    public class Test {

    public static void main(String[] args) {

               System.out.println(test4());

               System.out.println("y = " + y);
    }

    public static String test4() {
                   String aa = "aa";
             try {
                      aa = "bb";
                      return aa;
                } catch (Exception e) {
                     e.printStackTrace();
               } finally {
                    aa = "cc";
              }
               return aa;

    }

                                                                                                                                                                                                            正确答案:bb

    ********************************************************************************************************************************************************************************************

    public class Test {

    public static void main(String[] args) {

        int y = test5();

    }


    public static int test5() {
               int x = 1;
           try {
                        System.out.println("A");
                        return ++ x;
                } catch (Exception e) {
                        System.out.println("D");
               } finally {
                        System.out.println("B");
                       ++x;
             }
              System.out.println("C");
              return x;
        }

                                                                                                                                                                                               正确答案:A   B   2

  • 相关阅读:
    搭建Apache服务器并使用自签证书实现https访问
    常见加密算法
    awk命令用法
    systemd的新特性及常见的systemd unit类型分析
    kickstart文件制作与光盘镜像制作
    grub启动引导程序配置及命令行接口详解
    Linux启动流程(CentOS6)
    Linux相关网络命令
    rpm与yum,at与crontab,sed命令使用
    腾讯明眸极速高清升级2.0,助力韩国赛事超高清5G直播
  • 原文地址:https://www.cnblogs.com/suger-4/p/11972431.html
Copyright © 2011-2022 走看看