This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
If an instance initializer block does not catch a checked exception that can occur during its execution ,then the exception must be declared in the throw clause of every constructor in the class. One the other hand it is also written that constructor can not specify exception in the header. please explain thanks in advance
Hi Payal, Your second statement is wrong (your other hand is incorrect)! To prove it wrong we can just look at the java.io.* package and see many constructors with exceptions specified. For example, let's look at FileInputStream: public FileInputStream(File file) throws FileNotFoundException Regards, Manfred.
Payal, That is correct - If the instance initializer is not catching a Checked Exception the Constructor should take care of it, by declaring in the throws clause. The following code snipplet may be useful
Hope this helps, Sandeep SCJP2,OCSD(Oracle JDeveloper), OCED(Oracle Internet Platform)
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com