can I use the try...catch statement on java to stop the execution of codes on error? just like the exit sub on vb
aldeene 0 Junior Poster in Training
Recommended Answers
Jump to Poststop the execution of codes on error
It works the opposite way. A catch can allow the program to continue executing when there is an error. Go to this site and read up:
http://docs.oracle.com/javase/tutorial/essential/exceptions/index.html
Jump to Postbut, 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)
...
All 5 Replies
NormR1 563 Posting Sage Team Colleague
aldeene 0 Junior Poster in Training
NormR1 563 Posting Sage Team Colleague
aldeene 0 Junior Poster in Training
stultuske 1,116 Posting Maven Featured Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.