0

can I use the try...catch statement on java to stop the execution of codes on error? just like the exit sub on vb

3
Contributors
5
Replies
6
Views
5 Years
Discussion Span
Last Post by stultuske
0

hmmm.. so what statement should I use? coz i'm trying to stop the execution of code when an error occurs

0

The exception will stop the execution of code at the point of the error.
The catch will "catch" the execution and allow the program to continue executing in the catch block's code.

0

but, off course, if you write in your catch-block some statements that will exit the program, you can there end your program any way you want:
displaying a stacktrace
not displaying a stacktrace
giving an error message (popup)
...

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.