Exception

Hello friends

http://www.ssuet.edu.pk/taimoor/books/1-57521-197-1/ch10.htm

The first step is to modify the passingGrade() method definition to include the throws clause. The throws clause lists the types of exceptions that can be thrown by the method. In the following revised code, the method throws only an exception of type Exception:

static boolean passingGrade( int correct, int total )
throws Exception {

boolean returnCode = false ;

The rest of the method remains largely unchanged. This time, the method checks to see whether its arguments make sense. Because this method determines passing grades, it would be un-reasonable to have more correct responses than total responses. Therefore, if there are more correct responses than total responses, the method throws an exception.

May someone explain more?

Another question is:

http://safari.oreilly.com/1565927184/ch04-13203

can a statement like this throws exception to further methods?

sendrequest throws IOexception

Thanks!
[1139 byte] By [Abalfazl] at [2007-11-20 11:53:56]
# 1 Re: Exception
May someone explain more?Well apart from the fact that you shouldn't really be throwing Exception you should sub class it and throw instantiations of your sub class I thought it was fairly well explained (assuming you read the whole tutorial and not just the bit you posted) - what are you having trouble understanding.
Another question is:

http://safari.oreilly.com/1565927184/ch04-13203

can a statement like this throws exception to further methods?

sendrequest throws IOexceptionSafari is a subscription service which I do not have a subscription to so your link doesn't show anything useful.
The bit of code you have shown is not valid Java but without the context it's hard to say why it has be written like that - it may be just a typo.
keang at 2007-11-10 2:13:54 >