When using specific classes in java, why am I seemingly forced to supply exception handling for certain classes in java api?
such as :
private DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
private DocumentBuilder db;
try {
db = dbf.newDocumentBuilder();
} catch(Exception e) {}
Will compile, but :
private DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
private DocumentBuilder db;
db = dbf.newDocumentBuilder();
Will not. Why? Could some one please clarify this for me? Can I not just let the possible exception affect my program at runtime without handling it?