Le dernier programme qui me pose probleme avec un string
le compilateur m'indique :
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 class exo102 { static boolean egalite (char[] t, String s) { boolean res = false; for (int i=0; i<t.length; i++){ t[0]= t[0] + 1; } for (int i=1; i<10; i++){ s = s + i; if ( t[0] .equals s(0)){ res = true; }else{ res = false; } return res; } } public static void main (String [] args) { char [] t1 = {'m','i','n','c','i'}; String s1 = "mince"; Terminal.ecrireStringln( "" + s1.equals (t1)); Terminal.ecrireStringln( " y a t'il les memes caracteres dans le meme ordre " + (egalite(t1,s1))); } } //erreurs de compilations
quesaco ??
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14 C:\Documents and Settings\rohmer>javac "C:\Documents and Settings\rohmer\exo102. java" C:\Documents and Settings\rohmer\exo102.java:9: ')' expected if ( t[0] .equals s(0)){ ^ C:\Documents and Settings\rohmer\exo102.java:9: ';' expected if ( t[0] .equals s(0)){ ^ C:\Documents and Settings\rohmer\exo102.java:11: 'else' without 'if' }else{ ^ 3 errors
Partager