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

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

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.

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)