/** * * un exemple des blocs: try-catch-finally * * @author Mughal & Rasmussen * @author Mohamed Lokbani pour l'emballage! * * @version 1.1 */ class A extends Throwable {} class B extends A {} public class exo3 { public static void f() throws B { throw new B(); } public static void main (String [] args) throws A { try { f(); } finally { System.out.println("end!"); } catch (A e) { throw e; } } } /* lokbani>inclure jdk lokbani>javac exo3.java lokbani>java exo3 exo4.java:29: 'catch' without 'try' catch (A e) { ^ 1 error ------------------ le bloc catch doit être contigü avec le bloc try: correction try { f(); } catch (A e) { throw e; } finally { System.out.println("end!"); } affichage après correction: voir le fichier exo33.java */