I have a class that is created for the sole purpose of hadnling notifications for system x. Now when am carrying out operations in system x, n number of exceptions may be generated. I created ArrayList in my notification class to store all these exceptions. I later want to iterate over that list to check for various types of exceptions. E.g. I want to iterate and see if exception for sqlConnection occured, and then for next exception which may be SQL query, and so on.
How can this be achieved? The idea is like this:
if exception for sqlconnection was found
exceptionMessage += "Connection Failed";
if exception for whatever was found
exceptionMessage += "whatever exception"
etc...
Thanks,
if (exception instanceof SQLException) handleSQLException(); if (exception instanceof IOException) handleIOException();and on but in a nice and clean way