aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Query Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Query" Watch "Query" New topic
Author

Query

ashish mittal
Greenhorn

Joined: Jul 14, 2001
Posts: 5
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 ???
Ashik Uzzaman
Ranch Hand

Joined: Jul 05, 2001
Posts: 2370

Ofcourse ctrs can throw any exception....
------------------
azaman


Ashik Uzzaman
Senior Member of Technical Staff, Salesforce.com, San Francisco, CA, USA.
Muhammad Farooq
Ranch Hand

Joined: May 08, 2001
Posts: 356
Construtor can throw an exception, but cannot declare the exception in their header with the clause "throws".
HTH
--Farooq


Muhammad Farooq<br />Sun Certified Programmer for Java 2 Platform<br />Oracle8i Certified Professional Database Administrator
Gurpreet Sachdeva
Ranch Hand

Joined: Feb 20, 2001
Posts: 90
Hello Ashish,
Its mistake in the book, please see its errata pages for more details.You can view it at: http://www.ii.uib.no/~khalid/pgjc/jcbook/errata.html

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>
Ashik Uzzaman
Ranch Hand

Joined: Jul 05, 2001
Posts: 2370


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
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
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.
 
Don't get me started about those stupid light bulbs.
 
subject: Query