Learn Java Programming - Exceptions: Multi-catch Tutorial

Publié le: 16 septembre 2015
sur la chaîne: Daniel Ross
710
4

There will often be occasions where you may need to catch more than one exception. You can have multiple catch statements with each one specifying a single exception class and then a code block for handling the exception. This could lead to a lot of redundant code. With a multi-catch statement you can catch multiple exceptions in the same statement.
A multi-catch statement looks like this:
catch ( NullPointerException | IndexOutOfBoundsException | InvalidArgumentException e) { ... }


Sur cette page du site, vous pouvez voir la vidéo en ligne Learn Java Programming - Exceptions: Multi-catch Tutorial durée heure minute seconde en bonne qualité , qui a été Téléchargé par l'utilisateur Daniel Ross 16 septembre 2015, Partagez le lien avec vos amis et connaissances, sur youtube cette vidéo a déjà été regardée 710 fois et il a aimé 4 téléspectateurs. Bon visionnage!