Remember that if you declare throws [AnException] it comes after the parameters are defined in the method (i.e. after parens before first curly brace). If you declare an exception that way the code will compile, but any uncaught exceptions will still cause runtime errors. If you wrap code that causes the exception in a try catch the code will compile and run fine. Remember that the compiler only checks if you handle / declare checked exceptions. Runtime exceptions don't come into play until runtime