How Do I Terminate A Method?
Ive got a button on a jFrame, which does various things, getting data, etc.
Ive got a few try/catches in the buttons method and basically if it gets to a catch method i want the method to terminate, theres no point in continuing!
Im not sure how you do it.I dont want to terminate the whole program, just that method.
Please show me where i can find out how to do it.
Ant...
> > in your try/catch you can return null values and
> > where ever you are acessing the method check for
> null.
>
> why bother with that? why not just let the exception
> be thrown? talk about your boilerplate!
It wouldn't always be appropriate to bubble up exceptions exposed by the internal workings of a method. For example, if part of a method's internal workings is just checking whether or not a string value represents an integer, common practice is to attempt Integer.parseInt and catch the exception. It may be that if it isn't numeric, a different code path in the method is taken but is still to work successfully (not throw an exception back to the caller).
But I think I get your general drift.