Is exception handling useful in
compile time errors
logical errors
and even runtime errors?
sharathg.satya
-10
Posting Whiz in Training
Recommended Answers
Jump to PostIs exception handling useful in
compile time errors
logical errors
and even runtime errors?Exceptions are only used for runtime errors in code. The compile time errors/ logical errors are thanks to the actual java compiler, as far as i know.
Jump to Postwell
but if we consider
int a=3,b,c;
and we input the value of b from the user who may think it can be any value
and after few executable statements if we have ....
c=a/b;
and if the value of b is 0 even here we know that we can …
Jump to Postas you said in your example this is a logical error...
it's the user using the code in a way it was not intended, and yes, the developer should have foreseen the possibility, but trust me, it's a runtime exception :)
a logical error would happen every time you …
Jump to Postcheck edited post, better explanation now
my previous post was still based on the unedited version :)
also: mismatched/placed brackets, .. can be logical errors too ;) :D
All 15 Replies
DavidKroukamp
105
Master Poster
Team Colleague
Featured Poster
DJSAN10
28
Posting Whiz in Training
stultuske
1,116
Posting Maven
Featured Poster
sharathg.satya
-10
Posting Whiz in Training
sharathg.satya
-10
Posting Whiz in Training
stultuske
1,116
Posting Maven
Featured Poster
sharathg.satya
-10
Posting Whiz in Training
stultuske
1,116
Posting Maven
Featured Poster
DavidKroukamp
105
Master Poster
Team Colleague
Featured Poster
stultuske
commented:
nice summarize
+14
stultuske
1,116
Posting Maven
Featured Poster
DavidKroukamp
105
Master Poster
Team Colleague
Featured Poster
stultuske
1,116
Posting Maven
Featured Poster
DavidKroukamp
105
Master Poster
Team Colleague
Featured Poster
sharathg.satya
-10
Posting Whiz in Training
dewitt-joyce
0
Newbie 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.