Exception unique
  public class MyException extends Exception {
    ...
  }
try Si une exception se produit dans le bloc try, le traitement est interrompu et le bloc catch est traité.
try
  ...
  void method(){
    try{
      ...
    } catch (MyException1 | MyException2 e){
      ...
    } catch (MyException3 e){
      ...
    } finaly {
      ...
    }   
  }
# throws, throw
Utilisez throws lorsqu'une méthode peut transmettre une exception à l'appelant.
Utilisez également throw lorsque vous lancez explicitement une exception. l
#### **`throws`**
```java
class classA {
  void methodA() throes MyExceptionA {
    ...
    if(isError){
      throw new MyException();
    }
    ...
  }
}
Recommended Posts