Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Java > Java and JDK > BOOK: Beginning Java 2
Password Reminder
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: Beginning Java 2
This is the forum to discuss the Wrox book Beginning Java 2, SDK 1.4 Edition by Ivor Horton; ISBN: 9780764543654
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning Java 2 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old February 4th, 2004, 01:14 PM
Authorized User
Join Date: Sep 2003
Location: den Haag, , Netherlands.
Posts: 98
Thanks: 0
Thanked 0 Times in 0 Posts
Default Throwable 'causes'

I am still working my way through Ivor Horton's masterpiece (Great and challenging exercises!). At chapter 7 I found the Throwable class of the JDK 1.4 version have some new features that aren't covered in my JDK 1.3 book. Such as: one Exception can cause another Exception to be thrown, and this constitutes a hierarchy of causes for Throwables.

- would Ivor have wanted me to delve into these myself?
- have these become essential features of the Java language?
- are these gonna be important for the Sun Certification?
- do you find these can be put to good use in your programs?

I find these rather esoteric features, but I may be wrong about these..

Long awaiting any answer..
- freeZotic
  #2 (permalink)  
Old February 19th, 2004, 09:51 AM
Authorized User
Join Date: Sep 2003
Location: den Haag, , Netherlands.
Posts: 98
Thanks: 0
Thanked 0 Times in 0 Posts

Having studied the SDK1.4 API now, I'll answer my questions for myself:

From chapter 7 onwards, always have the new Java API opened whilst studying the book.

At the end of the chapter on Exceptions Ivor gives an example of how to provide the Exception message with more 'granularity'.
The new 'chained exception facility' uses causes for exactly the same purpose. So assigning a causing Exception to a newly created Exception is an essential feature of the Java language, and should be learned.
The SDK 1.4. API -see: class 'Throwable', explains how causes can be used, with a practical example.

There are two ways to create a 'cause' for any subclass of Throwable:
1. Use a constructor for your exception, that accepts a cause as an argument.
2. Use the Throwable method initCause() to initiate a cause for an existing exception.

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

All times are GMT -4. The time now is 11:32 AM.

Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.