Salut à tous,
J'ai un pb avec la question suivante:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
public class Explorer3 {
	 static void test() throws Error {
		    if (true) throw new AssertionError();
		    System.out.print("test ");
		}
 
		public static void main(String[] args) {
		    try { test(); }
		    catch (Exception ex) { System.out.print("exception "); }
		    System.out.print("end ");
		}
 }
What is the result?
A.end  
B.Compilation fails  
C.exception end  
D.exception test end  
E.A Throwable is thrown by main  
F.An Exception is thrown by main
Il n'y a pas d'erreur de compilation, et à l'exécution ça donne:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
 
Exception in thread "main" java.lang.AssertionError  
    at Explorer3.test(Explorer3.java:3)  
    at Explorer3.main(Explorer3.java:8)
J'hésite entre les réponses E et F...
Quelqu'un peut m'éclairer là dessus???
Merci d'avance à tous...