0
Can it be only try block ?
Done some research and found out that try + finally is used but can't find info on only try block. Is it possible to compile ?
2 odpowiedzi
+ 3
Bartek O. Yes it is possible to have try block without catch and finally block. Compiler will never give any error and program will run successfully but you can't handle exception and nullify the objects which is very important.
+ 1
Finally is not mandatory, update: In C# even catch is not mandatory. But you can catch the most generic error cases and leave the branch empty.