bonjour
voila j'ai un probleme avec ma fonction main.
Je dois fair eun test pour voir le nombre de parametre entré via Args[]
Mon probleme c'est qui le reconnais pas ma méthode lenght() qui il memsemble inclus par default avec le package java.lang
ùMerci d'avance
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 public static void main (String Args[]) { if (Args[0].matches("(?i)run") && (Args.length()!=1)) runAndExit(); else { if (Args[0].matches("(?i)add") && (Args.length()!=3)) addAndExit(Args[1], Args[2]); else { if (Args[0].matches("(?i)list") && (Args.length()!=1)) listAndExit( ); else { if (Args[0].matches("(?i)email") && (Args.length()!=2)) emailAndExit(Args[1]); else { if (Args[0].matches("(?i)new") && (Args.length()!=2)) newAndExit(Args[1]); else { usageAndExit("Option inconnue"); } } } } } }
voici mon code d'erreur :
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 C:\Users\Legényes\Documents\esi\Techniques informatiques\Laboratoire de langage de programmation Java\g28654\java\projet\todo2email\Todo2email.java:17: cannot find symbol symbol : method length() location: class java.lang.String[] if (Args[0].matches("(?i)run") && (Args.length()!=1)) runAndExit(); ^ C:\Users\Legényes\Documents\esi\Techniques informatiques\Laboratoire de langage de programmation Java\g28654\java\projet\todo2email\Todo2email.java:19: cannot find symbol symbol : method length() location: class java.lang.String[] if (Args[0].matches("(?i)add") && (Args.length()!=3)) addAndExit(Args[1], Args[2]); ^ C:\Users\Legényes\Documents\esi\Techniques informatiques\Laboratoire de langage de programmation Java\g28654\java\projet\todo2email\Todo2email.java:21: cannot find symbol symbol : method length() location: class java.lang.String[] if (Args[0].matches("(?i)list") && (Args.length()!=1)) listAndExit( ); ^ C:\Users\Legényes\Documents\esi\Techniques informatiques\Laboratoire de langage de programmation Java\g28654\java\projet\todo2email\Todo2email.java:23: cannot find symbol symbol : method length() location: class java.lang.String[] if (Args[0].matches("(?i)email") && (Args.length()!=2)) emailAndExit(Args[1]); ^ C:\Users\Legényes\Documents\esi\Techniques informatiques\Laboratoire de langage de programmation Java\g28654\java\projet\todo2email\Todo2email.java:25: cannot find symbol symbol : method length() location: class java.lang.String[]
Partager