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

  • 相关阅读:
    洛谷P2894 [USACO08FEB]酒店Hotel
    codevs 3981 动态最大子段和
    舞蹈家怀特先生(线型)
    IOS8 通知中心(Notification Center)新特性
    WWDC2014 IOS8 APP Extensions
    IOS8 TouchID使用介绍
    IOS8 UIAlertController 弹框
    Unable to run Kiwi tests on iOS8 device
    registerForRemoteNotificationTypes: is not supported in iOS 8.0 and later
    iOS开发---- 开发错误汇总及解决方法
  • 原文地址:https://www.cnblogs.com/suger-4/p/11972431.html
Copyright © 2011-2022 走看看