Qu’advient-il si une méthode déclare une exception non contrôlée?

Author:


{filelink=4348}

public class ExceptionNonControle {

  public void ExceptionInc() {
    String s = " 1985";
    int i = conversionString(s);  // Appel de la m�thode de conversion avec un String Non Conforme
    System.out.println("parseit(" + s + ") returned " + i);
  }

  public int conversionString(String input) throws NumberFormatException {
    return Integer.parseInt(input); //Convertir le String en num�rique
  }

    public static void main(String[] argv) {
      new ExceptionNonControle().ExceptionInc();
  }
}

A Voir sur le même Sujet:

  • code source java

Leave a Reply

Your email address will not be published. Required fields are marked *