|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
|
|
#1
|
|||
|
|||
|
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 URL Thanks, daisy |
|
#2
|
|||
|
|||
|
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..../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 |
|
#3
|
|||
|
|||
|
Thanks waldthau
That is just what I needed :-)
|
![]() |
| Viewing: Dev Shed Forums > Programming Languages > Java Help > How do I know what Exception will be thrown? |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|