[Android学习笔记]try-catch

private boolean test() {
        boolean result = true;
        String str = null;
        try {
            Log.d("test","出现异常之前");
            int length = str.length();
            Log.d("test","出现异常之后");
        } catch (Exception e) {
            result = true;
            Log.d("test","catch块");
        }
        result = false;
        Log.d("test","catch执行完成之后");
        return result;
    }

原文地址:https://www.cnblogs.com/hellenism/p/4178142.html