0

java multiple exception

i am just curious, if we can handle any kind of exception using catch(Exception e), then why need to have other multiple catch..?

30th Nov 2018, 2:48 PM
xegai
xegai - avatar
1 Resposta
+ 7
In complex applications we can get error from multiple places . Just to find that that exception is of what type so that we can quickly focus only on that type of exception Example If we get arithmetic exception divide by 0 We know that at some division operation this exception has occurred and hence we search only for that. But if we get only exception we don't know which type of exceptions occurred. We only know that an exception occured.Hence we have to search the whole try block
30th Nov 2018, 2:56 PM
Rstar
Rstar - avatar