Is it possible that we catch the exception without using try block? | Sololearn: Learn to code for FREE!
+ 2

Is it possible that we catch the exception without using try block?

28th Oct 2016, 5:31 PM
C Shashi Narayan Rao
C Shashi Narayan Rao - avatar
4 odpowiedzi
+ 4
If it is a code error, no. The program will crash.
28th Oct 2016, 6:03 PM
nedas
nedas - avatar
+ 1
You can avoid the exception with if-else statement only if the exception is unchecked (extends from RuntimeException).
1st Nov 2016, 6:20 AM
Simone Trombiero
0
exceptions can be handled with try-catch block. we cannot declare catch without try and even we cannot declare try without catch or finally.
4th Nov 2016, 3:52 PM
KISHAN KUMAR
0
Exception Handling is a mechanism to handle the runtime errors by based on "try and catch" or “throw and catch” principle. so we cannot catch the exceptions without try block.
16th Nov 2016, 5:23 AM
D Naveen Kumar
D Naveen Kumar - avatar