package youxia;public class ShaoNian { public String testException() { try { throw new RuntimeException("hehe"); } catch (Exception e) { return "catch"; }finally { return "finally"; } } public static void main(String[] args) { ShaoNian shaoNian=new ShaoNian(); String excp=shaoNian.testException(); System.out.println(excp); }}
输出结果:
finally