June 2017
Beginner
1296 pages
69h 23m
English
... executed in throwException"); 32 } 3334 // code here would not be reached; would cause compilation errors 35 } 36 37 // demonstrate finally when no exception occurs 38 public static void doesNotThrowException() { 39 try { // try block does not throw an exception 40 System.out.println("Method doesNotThrowException"); 41 } 42 catch (Exception exception) { // does not execute 43 System.err.println(exception); 44 } 45 finally { // executes regardless of what occurs in try…catch 46 System.err.println("Finally executed in doesNotThrowException"); 47 } 48 49 System.out.println("End of method doesNotThrowException"); 50 } 51 }
Method throwException Exception handled in method throwException Finally executed in throwException Exception handled in main Method ...
Read now
Unlock full access