Tag: 尝试了 终于

理解’finally’块

我写了七个测试用例来理解finally块的行为。 finally如何运作的逻辑是什么? package core; public class Test { public static void main(String[] args) { new Test().testFinally(); } public void testFinally() { System.out.println(“One = ” + tryOne()); System.out.println(“Two = ” + tryTwo()); System.out.println(“Three = ” + tryThree()); System.out.println(“Four = ” + tryFour()); System.out.println(“Five = ” + tryFive()); System.out.println(“Six = ” + trySix()); System.out.println(“Seven = ” + […]