My question is why we need to handle runtime exception in the above program.? Actually we neednot declare or handle runtime exceptions right.. Can anyone clear my doubt?
[ December 03, 2008: Message edited by: Ganeshkumar cheekati ]
You are correct. We need not handle the runtime exception in the above case. But in practical situations we may want to absorb any such errors and not allow the flow of the code to be disrupted. I guess that is what is being achieved in the code above. Whenever an exception is caused return 1 and don't stop the flow of the program.