🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.language
Article #17219

Re: Throws

#17219
From: Steve Schafer (TeamB)
Date: Thu, 03 Dec 1998 00:00
18 lines
1033 bytes
On Thu, 03 Dec 1998 12:54:00 -0800, Shahid Juma <shahidj@interlog.com>
wrote:

>    How do you throw an exception such as EmptyStackException?  Do you
>do something like this:
>
>public Object test (Object d) throws EmptyStackException {
>}
>
>I tried that and it doesn't do it.

That declaration tells the compiler that the test method is _capable_
of throwing an exception. To actually throw the exception somewhere
within the body of the method:

 throw new EmptyStackException();

-Steve
Technical Details
Message-ID: <3732fbbd.825410610@90.0.0.40>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <3666FA68.1AE15DBC@interlog.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f74b3,32517523289d282
X-Google-Attributes: gidf74b3,public
From: pandeng@telepath.com (Steve Schafer (TeamB))
Subject: Re: Throws
Date: 1998/12/03
Message-ID: <3732fbbd.825410610@90.0.0.40>
X-Deja-AN: 418365015
Content-Transfer-Encoding: 7bit
References: <3666FA68.1AE15DBC@interlog.com>
Content-Type: text/plain; charset=us-ascii
Organization: TeamB
Mime-Version: 1.0
Reply-To: pandeng@telepath.com
Newsgroups: borland.public.jbuilder.java.language