遇到的一道面试笔试题,输出程序运行后的打印结果:
class ReturnAndFinally{ static String fun(){ try { int v = 1/0; }catch (Exception ex){ return "ERROR"; }finally { return "OK"; } } public static void main(String[] args) { String s = fun(); System.out.println(s); } }
打印后的结果为:OK