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 ?
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 ?