Select the correct answerWhich of these statements is incorrect?Optionstry block need not to be followed by catch blocktry can be followed by both catch and finally blocktry need not to be followed by anythingtry block can be followed by finally block instead of catch block
Question
Select the correct answerWhich of these statements is incorrect?Optionstry block need not to be followed by catch blocktry can be followed by both catch and finally blocktry need not to be followed by anythingtry block can be followed by finally block instead of catch block
Solution
The incorrect statement is: "try need not to be followed by anything". In Java, a try block must be followed by either a catch block or a finally block, or both.
Similar Questions
Select the correct answerWhich of the following blocks will be executed whether an exception is thrown or not?Optionselsefinallyassertexcept
Select the correct answerWhich of these keywords are used for the block to be examined for exceptions?Optionstrythrowcheckcatch
Select the correct answerWhich of these keywords must be used to handle the exception thrown by try block in some rational manner?Optionstrythrowcatchfinally
Select the correct answerWhat happens if an exception is not caught in the catch block?OptionsThe exception is ignoredThe finally block handles itThe exception is thrown to the caller methodThe program terminates immediately
Select the correct answerWhich of the given blocks is used to handle the exceptions generated by the try block?Optionstrythrowcheckcatch
Upgrade your grade with Knowee
Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.