A try statement must always have a ___ associated with it.
Select 1 option
Correct Option is : D
A try without resources must have either a catch or a finally. It may have both as well.
Thus, the following constructs are valid:
1. try{// w w w .j a v a 2s.c om } catch (Exception e){ } // no finally 2. try{ } finally{ } // no catch 3. try{ }catch (Exception e){ } finally{ } 4. A catch can catch multiple exceptions: try{ }catch (Exception1|Exception2 |Exception3 e){ }
try with resources may omit catch as well as finally blocks.