hi all , just have a little doubt . The khalid book says that ctors cannot display exceptions in header , whereas in more than one study notes , its said that ctors can throw any exception ???
Gurpreet Sachdeva For mock exams and other useful pages(including topics like bitshift operator, garbage collection,inner classes,etc) please visit: http://www.go4java.20m.com [This message has been edited by Gurpreet Sachdeva (edited August 18, 2001).]
Regards<BR>Gurpreet Sachdeva<P>For Mock Exams, FAQ, Exam tips and some useful information about Bitshift operator, inner classes, garbage collection,etc please visit: <A HREF="http://www.go4java.lookscool.com" TARGET=_blank rel="nofollow">http://www.go4java.lookscool.com</A>
Construtor can throw an exception, but cannot declare the exception in their header with the clause "throws
Farooq, I disagree with u in this respect. Constructors can throw any exception and also can declara in its header the unhandled exceptions it throws. See the following code.
------------------ azaman
Muhammad Farooq
Ranch Hand
Joined: May 08, 2001
Posts: 356
posted
0
You are rite Aazman, Thanks for pointing out. Is it the same for checked or unchecked exceptions. --Farooq
ashok khetan
Ranch Hand
Joined: Jul 29, 2001
Posts: 153
posted
0
hi all, i am agree with ashik, it's a mistake in khalid book(page 101). if the constructor doesn't declare any checked exception in the header using throws clause then it would produce an error. ashok.