Java Keywords

An (incomplete) list of the keywords in the Java language.

  1. Java Keyword: catch
    The Java keyword 'catch' is explained. The keyword is used to catch an exception and follows immediately after a try block.
  2. Java Keyword: finally
    The 'finally' keyword is used to open a block of code that executes after the preceeding try block. A finally block is often used to restore state, for instance by releasing resources aquired in a try block.
  3. Java Keyword: throw
    The Java keyword 'throw' is explained. The keyword is used to throw an exception. 'throw' followed by an expression of type Throwable forms a statement.
  4. Java Keyword: throws
    The Java keyword 'throws' is explained. The keyword is used in method declarations to indicate what exceptions may be thrown by calling the method.
  5. Java Keyword: try
    The 'try' keyword is used to open a block of code that potentially throw exceptions. A try block is followed by one or more catch blocks to catch any exceptions thrown.