#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2001
    Posts
    3
    Rep Power
    0
    Hiya everybody,

    I don't have much experience in java and am about to write a class which uses a lot of library classes. How do I know what exceptions the class will throw? Also does anyone know any definitive websites that will help me understand all the possible exceptions that can be thrown by java methods? (Please don't just point me to http://java.sun.com!)

    Thanks,

    daisy
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2001
    Location
    Colorado
    Posts
    46
    Rep Power
    14

    Post


    There's not a real simple way to find out what exceptions will be thrown, but here are two options:

    - You could write your code w/o any try/catch blocks and try to compile your program. This isn't to efficient, but the compiler will tell you what exceptions need to be caught.

    - A better way is to visit the API documentation which is on Sun's site. The API for the 1.2.2 JDK can be found at http://java.sun.com/products/jdk/1.2...api/index.html (If you go to http://java.sun.com/docs/index.html you can find links for the API documentation of other JDKs as well.)I know you didn't want to be pointed to java.sun.com, but the API documentation will show you the exceptions that can be thrown for each method in each class. (Although some methods do not throw any exceptions.)

    I hope that helps you out, even though I mentioned java.sun.com. 8^)
    - MW
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2001
    Posts
    3
    Rep Power
    0

    Thanks waldthau


    That is just what I needed :-)

IMN logo majestic logo threadwatch logo seochat tools logo