Apologies if this has been discussed on other threads but I find it helps clarify my thinking when I am forced to write down my questions. I am trying to properly understand the concept of checked vs unchecked exceptions and exception translation in Java but I am getting confused. So far I understood that checked exceptions are exceptions that need to be always caught in a try/catch block otherwise I get a compile time error. This is to force programmers to think about abnormal situations that might happen at run time (like disk full etc). Is this right? What I did not get was why we have unchecked exceptions, when are they useful? Is it only during development time to debug code that might access an illegal array index etc? This confusion is because I see that Error exceptions are also unchecked as is RunTimeException but its not clear to me why they are both lumped together into an unchecked category?
EDIT: Ok, I think I can boil down my question to be more specific after thinking about it more. If a Java method throws a checked exception and it makes more sense to handle it two layers above, should I just keep rethrowing the same checked exception in every layer (i.e bubbling up) till it gets to the layer where it can be handled? Or alternatively I can throw a more specific (unchecked perhaps) exception that the layer above me can interpret more meaningfully?