This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Could someone tell me where to find the information for this question? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Could someone tell me where to find the information for this question?" Watch "Could someone tell me where to find the information for this question?" New topic
Author

Could someone tell me where to find the information for this question?

kenny gill
Ranch Hand

Joined: Mar 12, 2012
Posts: 54

The question I'm being asked:

I do not want to look at documentation to see if the methods I use cause exceptions. If there is a problem, there are two distinct ways that Java will let me know. What are they?
Ishan Pandya
Ranch Hand

Joined: Feb 06, 2012
Posts: 219

I guess they are "catch" and "throws".


OCPJP
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 37891
    
  22
You do need to look at the documentation, which should tell you. Look at this constructor and this method, for example. Note the unchecked Exception in one case appears only in the Javadoc and the checked Exception in the other case appears as a throws clause, too.
Note that unexpected unchecked Exceptions might not be listed at all; if you pass 0 and suffer an ArirthmeticException, that might not be anticipated or recorded.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Could someone tell me where to find the information for this question?
 
Similar Threads
tricky for loop
Collection Question for SCJP
Seam - lurning curve
Doubt in Sun's 1.4 Practice xam
Properties file