What is exception handling?
An unwanted unexpected event that disturbs normal flow of the program is called Exception.
Examples of exception:
1. If user try to Divide the number by Zero or
2. Try to print a data which is not in range of Array.
3. If users try to pop out of an Empty Stack, it will throw an Exception.
4. If users try to push into a Stack which is full, it will again throw an Exception.
5. If user try to open a file which is not created.
Why need exception handling?
If you have no exception handling, and something goes wrong with the program (you divide by 0, you input alpha into a numeric variable, larger problems), the program crashes.
With exception handling, the user can get a nice little “You can’t do that, because …”, hit OK, then be back where he was.
You catch your exception and give a message to it which is displayed when you run or execute the program.
This will help user to understand or find out where they did mistake in code.
Tririd Technologies Pvt Ltd is Best Software Company in Ahmedabad which provides Best Coding to the client across the world. We develop web application, mobile application and word press website according to client requirement.
For more information about Tririd Technologies Pvt Ltd.
Visit us @ http://www.tririd.com/portfolio/
Call us @ 8980010210