package tsp.cours.ci8; class NegativeValue extends Exception {} class Test { static double ln(double x) throws NegativeValue { if(x <= 0) { throw new NegativeValue(); } else { return Math.log(x); } } public static void main(String[] args) { try { double val = Double.parseDouble(args[0]); System.out.println(ln(val)); } catch(NegativeValue v) { System.out.println("Chiffre positif attendu"); } } }