·  JAVA – Syntax – Terms – Exceptions

 

- Info:

  - This tutorial shows basic exception handling in Java.

 

- Additional Tutorials:

  - Exceptions – Print Stack Trace

 

- Procedure:

  - Create JAVA Console Application Test.java

 

    Test.java

    public class MyClass {

      

      public static void main(String[] args) { 

    

        try{

          Integer i = null;

                  i.byteValue();

        }

        catch(Exception e){

          System.out.println(e.toString());     

        }

                       

      }

    

    }

 

    Output

    java.lang.NullPointerException