Why should I used try catch (in spite of not commiting error)

I have been using try-catch since the day I learned Java. Now my doubt is why is it I am forced to use a try catch in case I am not commiting an error to be caught. The cause of this doubt was when I was writing a code to parse an xml,
<documentbuilder object>= <documentbuilderfactory object>.somemethod().
This line above if not place in a try catch it gives an error.

Can anyone explain it. Thanks.
rmvprasadAsked:
Who is Participating?
 
CEHJConnect With a Mentor Commented:
Some exceptions have to be caught - you're forced to catch them. Runtime ones, you're not forced to
0
 
CEHJCommented:
:-)
0
All Courses

From novice to tech pro — start learning today.