Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Java by (7k points)

I know there is no way to find out which exceptions a method throws without looking up the API docs one-by-one. So, I would like to ask you which are the most common Exceptions and runtime exceptions you have come across when dealing with:

  • Casting

  • Arrays

  • Vector, ArrayList, HashMap, etc.

  • IO

  • Object Serialization

  • Threads

1 Answer

0 votes
by (13.1k points)

Assume that the below things belongs to java.lang unless I specify otherwise:

  • Casting: ClassCastException

  • Arrays: ArrayIndexOutOfBoundsException, NullPointerException

  • Collections: NullPointerException, ClassCastException

  • IO: java.io.IOException, java.io.FileNotFoundException, java.io.EOFException

  • Seralization: java.io.ObjectStreamException

  • Threads: InterruptedException, SecurityException, IllegalThreadStateException

Want to learn Java? Check out the Java certification from Intellipaat. 

Related questions

0 votes
1 answer
0 votes
1 answer
0 votes
1 answer

Browse Categories

...