java - ExceptionHandling mischief -


java gives compile time error if don't write try catch block or try block or pass exception it's calling function checked exception.that fine.but,my question why catch block made optional i.e. can write try block block so,it not dirty thing so..please correct me if wrong somewhere..

  • a calling method can handle exception
  • finally block allowed because there may code should run if exception thrown. may want close database connection or resources if exception thrown.

Comments

Popular posts from this blog

matlab - Deleting rows with specific rules -

jquery - How would i go about shortening this code? And to cancel the previous click on click of new section? -