Multiple catch in java

Multiple catch in java

public class MultipleCatch {

    public static void main(String args[]) {
        try {
            // This throw StringIndexOutOfBoundsException
            String str = "yami code";
            char c = str.charAt(5);

            // This throw NullPointerException
            String nullStr = null;
            nullStr.toLowerCase();

        }catch (StringIndexOutOfBoundsException e){
            // Catch index out of bounds exception
            System.out.println("Index out of bounds exception: ");
            e.printStackTrace();
        }catch (NullPointerException e){
            // Catch null pointer exception
            System.out.println("Null pointer exception: ");
            e.printStackTrace();
        }catch (Exception e){
            // Catch other exception
            e.printStackTrace();
        }
        System.out.println("End");
    }
}