As far as I understand, there is no way to find out which exceptions a method throws without looking up the API docs one-by-one.
Since that is no option, I’d like to reverse the research and ask you which are the most common Exceptions and RuntimeExceptions you’ve come across when dealing with:
- Casting
- Arrays
- Vector, ArrayList, HashMap, etc.
- IO (File class, streams, filters, …)
- Object Serialization
- Threads (wait(), sleep(), etc.)
- or anything else that is considered “basic Java”
I realize that this might be subjective and boring but it is for a class test and I really don’t know better.
Assume the below are
java.langunless I specify otherwise:You would do well to look at Java site’s Package Summary pages. Here’s one: https://docs.oracle.com/en/java/javase/20/docs/api/java.base/java/io/package-summary.html