Hi this exception thingy has always bothered me but i just never really cared until now. Now it's just annoying
and time consumming. I was wondering if any one knows what's happening

let 's say i have this method :

public foo( int whatever ) throws IllegalArgumentExc....
{
if (whatever > 5 )
throw new Ille.... ("Value is Invalid"):

int x = 5;

}

and then in my main () kinda look like this
try {

int it = 67;

foo(it);

}
catch (IllegalArgumentException e )
{
e.getMessage(); // doesn't not print anything
System.err.println("") // whatever this is will oviously get printed

}

Why isn't the message in the function get printed?, i tried other command from the Exception class
but i never get anything out. i always have to put a
System.out in there to see what happen. and even worse if i have more than one functions then i don't even know who threw it.

The way around this that i use is creating my exception class extending whatever i wanted to catch
and from there it would always print.
ex :

class CatchErrorException () extends Illegal...
{}

if i caught this in main, and foo was throwing this instead then it would display the "Value is Invalid " from the food method. is this the only way? i'm getting tired
of making classes that basically do the same thing just so i can have the Error output and know where it came from. In longer programs it's almost impossible to know where the Exception came from unless your write extension of all the exceptions you want to catch and no way i'm doing that .

If anyone still reading this far and know why java does this, please let me know, no rush on this.

thanks,
Mel


}