Bonjour,
Encore lors de mes révisions, pourriez-vous me donner votre avis à la question suivante:
26) Que sera l’affichage du programme suivant si le fichier Hello.txt est present dans le repertoire courant?
a) “File found”, “Doing finally”, “0”
b) “File found”, “0”
c) “0”
d) “Doing finally”, “0”
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 import java.io.*; public class Worker { public static void main (String argv[]){ Worker w = new Worker (); System.out.println (w.work()); } public int work() { try { FileInputStream dis = new FileInputStream("Hello.txt"); return 0; System.out.println ("File found"); } catch (FileNotFoundException fne) { System.out.println ("No such file found"); return -1; } finally { System.out.println ("Doing finally"); } } }
Partager