Which of these statements is incorrect? A) try block need not to be followed by catch block. B) try block can be followed by finally block instead of catch block. C) try can be followed by both catch and finally block. D) try block must always be followed by a catch block
Answers
Answered by
1
Answer:
Try block must always be followed by a Catch block
Answered by
0
Answer:
The incorrect statement is
D) try block must always be followed by a catch block.
Explanation:
- The 'try' statement/block allows the user to define a block of code which is to be tested for errors during execution.
- The 'catch' statement/block allows the user to define a block of code which is to be executed, in case an error occurs in the try block.
- In Java, it is not always compulsory for each try block to be followed by a catch block.
- The try block should be either followed by a catch block or finally block.
- The exceptions which are likely to be thrown should be declared in the throws clause.
Similar questions
Science,
6 months ago
Science,
6 months ago
Business Studies,
11 months ago
Computer Science,
11 months ago
History,
1 year ago
Chemistry,
1 year ago