How to use checked and unchecked exception?
By throwing a checked exception, you force the caller to handle the exception in a catch block. If a method throws a checked exception, it must declares that it throw the exception in the method declaration.
All exceptions are checked exceptions, except for those indicated by java.lang.Error, java.lang.RuntimeException, and their subclasses.
Runtime exception are exceptional conditions that are internal to the application, and that the application usually cannot anticipate or recover from. Runtime exceptions are those indicated by java.lang.RuntimeException and its subclasses.
RuntimeException are known as unchecked exception. It doesn't require to declare the unchecked exception in the method declaration.