-----------------------------------------------------------
New Message on BDOTNET
-----------------------------------------------------------
From: MVP_mayank
Message 1 in Discussion
The throws clause is used when declaring methods and indicates that under
certain circumstances the method will generate a specific exception.
For example, the declaration:
public String myMethod(Boolean state)
throws IOException {
indicates that the method myMethod() can generate an IOException. The throw
statement is used in the body of the method to actually generate the
exception under a specific condition, as follows:
if (testCondition)
throw new IOException(message);
So the complete code for the method could look like:
public String myMethod(Boolean state)
throws IOException
{
String message = "Another IOException";
String returnValue = "Hello World!";
if(state)
throw new IOEXception(message)
return returnValue;
}
This is fairly simplistic so for more detail you can try the online Java
Tutorial.
Hope this Helps
Regards,
Mayank Pujara ([EMAIL PROTECTED])
>From: "Jacob" <[EMAIL PROTECTED]>
>Reply-To: "BDOTNET" <[EMAIL PROTECTED]>
>To: "BDOTNET" <[EMAIL PROTECTED]>
>Subject: Re: difference between throws and throw
>Date: Sat, 11 Sep 2004 00:24:43 -0700
>
_________________________________________________________________
Millions of eligible singles.
http://www.bharatmatrimony.com/cgi-bin/bmclicks1.cgi?74 Find the perfect
match on BharatMatrimony.com
-----------------------------------------------------------
To stop getting this e-mail, or change how often it arrives, go to your E-mail
Settings.
http://groups.msn.com/bdotnet/_emailsettings.msnw
Need help? If you've forgotten your password, please go to Passport Member Services.
http://groups.msn.com/_passportredir.msnw?ppmprop=help
For other questions or feedback, go to our Contact Us page.
http://groups.msn.com/contact
If you do not want to receive future e-mail from this MSN group, or if you received
this message by mistake, please click the "Remove" link below. On the pre-addressed
e-mail message that opens, simply click "Send". Your e-mail address will be deleted
from this group's mailing list.
mailto:[EMAIL PROTECTED]