Computer Science, asked by iammegasree, 7 months ago

which of these statement is true?1) finally block gets executed only when there are exceptions. 2) finally gets always executed irrespective of the flow in try catch block.3)finally block can be present only when a catch block is present.4)finally block gets executed only when there are no exceptions. ​

Answers

Answered by Anonymous
7

Answer:

2)

Explanation:

Mark me as brilliant

Answered by qwsuccess
0

2) finally gets always executed irrespective of the flow in try catch block is true.

  • A “finally” is used to create a block of c.ode that follows a try or catch block.
  • A finally block contains all the c.odes such as closing connections, stream, etc. that is always executed whether an exception occurs or not in the try-catch block.
  • When finally block is attached with a try-catch block, it is always executed whether the catch block has handled the exception thrown by try block or not.
  • It is possible to use try and finally block without using catch block.
Similar questions