Can be a try block without catch? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Can be a try block without catch?

1st Jul 2018, 4:42 AM
Afresia
Afresia - avatar
5 Answers
+ 3
You can't write only try block it will throw you a compile time error. if you write try then you need to write either catch or finally block. so You can use finally instead of catch but that way your program is going to terminate abruptly since you are not catching the exception.
1st Jul 2018, 5:17 AM
Tanay
Tanay - avatar
+ 2
I think so, but when i answered the quiz, I got wrong. thanks for your respon Tanay Mufassil
1st Jul 2018, 9:50 AM
Afresia
Afresia - avatar
+ 2
Afresia your welcome😊😊😊
1st Jul 2018, 9:52 AM
Mufassil
Mufassil - avatar
+ 1
instead of catch you use finally or throw you can not use try block only it throw an expection
1st Jul 2018, 6:28 AM
Mufassil
Mufassil - avatar
0
привет! буду рад пообщаться с тобой)) hi! I will be glad to talk with you))
2nd Jul 2018, 5:49 AM
Александр Кольцов
Александр Кольцов - avatar