Considering this code, can I be absolutely sure that the finally block always executes, no matter what something() is?
finally
something()
try
Answer is simple YES.
INPUT:
try{ int divideByZeroException = 5 / 0; } catch (Exception e){ System.out.println("catch"); return; // also tried with break; in switch-case, got same output } finally { System.out.println("finally"); }
OUTPUT:
catch finally