bonjours,
je suis entraint d'ecrire un code java et la console me signale des erreurs et je veux bien m'expliquer de quoi il s'agit
et les erreurs:
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 import java.util.ArrayList; public class Parking { protected String state; protected int nVehicles; public String name; ArrayList<String > leftPark = new ArrayList<String>(); ArrayList<String> rightPark = new ArrayList<String>(); public Parking (String name){ state = new String("free"); nVehicles=0; this.name=name; } public synchronized void getPark(String direction){ while(!(state.equals("free")|| state.equals(direction))){ try{ wait(); } catch(InterruptedException e){ System.err.println(e); } } state = direction; if(direction.equals("leftToRight")) leftPark.add(this.name); else rightPark.add(this.name); } public synchronized void releasePark(){ if(rightPark.size() < 3){ state="free"; notifyAll(); } } }
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13 leftPark cannot be resolved rightPark cannot be resolved rightPark cannot be resolved Syntax error, parameterized types are only available if source level is 5.0 Syntax error, parameterized types are only available if source level is 5.0 Syntax error, parameterized types are only available if source level is 5.0 Syntax error, parameterized types are only available if source level is 5.0 The type ArrayList is not generic; it cannot be parameterized with arguments <String> The type ArrayList is not generic; it cannot be parameterized with arguments <String> The type ArrayList is not generic; it cannot be parameterized with arguments <String> The type ArrayList is not generic; it cannot be parameterized with arguments <String>
Partager