How many catch blocks can a try/catch block contain? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How many catch blocks can a try/catch block contain?

12th Oct 2015, 11:35 AM
Mohammad Salman Azam
Mohammad Salman Azam - avatar
5 Answers
+ 2
as many as you need
17th Oct 2015, 1:53 PM
Justin
Justin - avatar
+ 2
you can have many catches. also you can use || and &&
25th Jun 2016, 10:35 AM
DanI MicraS
DanI MicraS - avatar
+ 1
If you want multiple catches then you add them after each other. Multiple try's you would have to nest.
16th May 2016, 2:30 AM
Avery Durrant
Avery Durrant - avatar
0
you can have all mano catch for control you message of exceptions
2nd Jul 2016, 1:30 AM
Alfredo Morales
Alfredo Morales - avatar
0
Infinitely many. As long as you have space on your hard disk, you can keep on writing multiple catch blocks
17th Nov 2016, 5:01 PM
Prarabdh Garg
Prarabdh Garg - avatar