salut j'ai des message d'erreur et je ne sais plus comment les enlever puis executer mon code avec les thread voila le code
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
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85 package aa; import java.awt.*; import java.awt.event.*; import javax.swing.*; import java.util.*; import java.util.ArrayList; import java.util.Iterator; import java.io.*; import java.sql.*; class thread1 { public static ArrayList methode() { ArrayList A = new ArrayList(); Thread m1_IOThread = null; Thread m2_IOThread = null; Thread ATTEND = null; if (m1_IOThread == null) { m1_IOThread = new Thread() { public void run() { try { ArrayList s = calcule.methode(); System.out.println(s); } catch (Exception ex) { System.out.println(ex); } } }; m1_IOThread.setPriority(Thread.MIN_PRIORITY); m1_IOThread.start(); } if (m2_IOThread == null) { m2_IOThread = new Thread() { public void run() { try { ArrayList s = calcule.methode(); System.out.println(s); } catch (Exception ex) { } } }; m2_IOThread.setPriority(Thread.MIN_PRIORITY); m2_IOThread.start(); } if (ATTEND == null) { ATTEND = new Thread() { public void run() { while ( (m1_IOThread != null) && (m2_IOThread != null)) { try { this.sleep(100); } catch (Exception G) {} } ATTEND = null; } }; ATTEND.setPriority(Thread.MIN_PRIORITY); // UI has most priority ATTEND.start(); } return (A); } }
et les trois message d'erreur
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4 "thread1.java": local variable m1_IOThread is accessed from within inner class; needs to be declared final at line 62, column 23 "thread1.java": local variable m2_IOThread is accessed from within inner class; needs to be declared final at line 62, column 48 "thread1.java": local variable ATTEND is accessed from within inner class; needs to be declared final at line 70, column 14
les erreurs sur la lignes
while ( (m1_IOThread != null) && (m2_IOThread != null))
et la ligne
ATTEND = null;
merci de m'avoir m'aider
Partager