wood burning stoves 2.0*
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 OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA 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: 38517
    
  23
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.
 
Don't get me started about those stupid light bulbs.
 
subject: Could someone tell me where to find the information for this question?