Article View: aus.computers.java
Article #202Re: throwing exceptions
From: Darryl L. Pierce
Date: Tue, 22 Apr 2003 11:09
Date: Tue, 22 Apr 2003 11:09
26 lines
1949 bytes
1949 bytes
In comp.lang.java.help .Saphyr <saphyr@infomaniak.ch> wrote:
>> hal.openPodBayDoors();
>> try {
>> pod.enter();
>> }
>> catch (CannotEnterPodException e) {
>> hal.closePodBayDoors();
>> throw e;
>> }
>
>
> My question might sound basic but whats the point
> with the 'finally' statement ? Shouldn't it be used
> specifically for those cases ?
No. You may only want to close the pod bay doors if there's a problem
while trying to open them. Finally will _always_ execute; catch() will
only execute on an exception...
--
/**
* @author Darryl L. Pierce <mcpierce@myrealbox.com>
* @see The J2ME FAQ <http://bellsouthpwp.net/m/c/mcpierce/j2mefaq.html">
* @quote "What do you care what others think, Mr. Feynman?"
* @geek echo '$_ = "Jvtu bopuifs Pfsm ibdlfs."; y/a-z/za-y/; print' | perl
*/
Technical Details
Message-ID:
<d03432604a7adf8afc8e1f8ae318e4d4@news.teranews.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed-east.nntpserver.com!nntpserver.com!news.teranews.com!not-for-mailReferences:
<puIna.11699$hF.92186@news-server.bigpond.net.au> <qDIna.110$KS4.52@news.get2net.dk> <ryTna.20910$y3.1898552@news010.worldonline.dk> <3EA0185D.C7B1A753@sun.com> <3ea44135$1_2@news.tiscalinet.ch>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f5d71,36528a6761383b70
X-Google-Attributes: gidf5d71,public
X-Google-Thread: 10d6db,36528a6761383b70
X-Google-Attributes: gid10d6db,public
X-Google-Thread: 113ae9,36528a6761383b70
X-Google-Attributes: gid113ae9,public
X-Google-ArrivalTime: 2003-04-22 04:09:31 PST
X-Abuse-Report: abuse@teranews.com
Message-ID: <d03432604a7adf8afc8e1f8ae318e4d4@news.teranews.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed-east.nntpserver.com!nntpserver.com!news.teranews.com!not-for-mail
Date: Tue, 22 Apr 2003 11:09:30 GMT
Lines: 26
From: "Darryl L. Pierce" <mcpierce@softhome.net>
Subject: Re: throwing exceptions
Newsgroups: aus.computers.java,comp.lang.java,comp.lang.java.help
References: <puIna.11699$hF.92186@news-server.bigpond.net.au> <qDIna.110$KS4.52@news.get2net.dk> <ryTna.20910$y3.1898552@news010.worldonline.dk> <3EA0185D.C7B1A753@sun.com> <3ea44135$1_2@news.tiscalinet.ch>
User-Agent: tin/1.5.17-20030301 ("Bubbles") (UNIX) (Linux/2.4.20-1-686 (i686))