Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

When should we use Exception ?

$
0
0
I leanred exceptions are used to catch errors (such as: files, network, user input ).
Do we use it for every case ( listed above ) ?

For example devide for 0. We can use IF statment to check a variable then show a message to user instead of use exception ?
Or, working with files, we can check is it exists or not to avoid error ?

I don't know when should we catch error by our code ( ex: if, while..v.) or use Exception.

So, which situation should we use Exception ?

Viewing all articles
Browse latest Browse all 51036

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>