Methods with throws clause

This is the general form of a method declaration that includes a throws clause:

type method-name(parameter-list) throws exception-list 
// body of method 

exception-list is a comma-separated list of the exceptions that a method can throw.

public class Main {
  static void throwOne() throws IllegalAccessException {
    System.out.println("Inside throwOne.");
    throw new IllegalAccessException("demo");

  public static void main(String args[]) {
    try {
    } catch (IllegalAccessException e) {
      System.out.println("Caught " + e);
  Java Book 
    Language Basics  

Exception Handler:
  1. Exception Handling
  2. Exception Types
  3. try and catch
  4. Displaying a Description of an Exception
  5. Multiple catch Clauses
  6. Nested try Statements
  7. Creates and throws an exception
  8. Methods with throws clause
  9. finally
  10. Java's Built-in Exceptions
  11. Creating Your Own Exception Subclasses
  12. Chained Exceptions