J'ai commencé un nouveau projet aujourd'hui.
Je crée un programme afin de crypter du texte mais dès le premier algorithme je suis coincé ^^

Voici le bout de code concerné :

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
 
public class Test {
 
	public static char alpha [] = {'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
        public static boolean encore = true;
 
        public static void main (String [] args) {
 
		Scanner sc = new Scanner (System.in); 
 
		System.out.println ("Tapez \"/h\" pour voir la liste des commandes");
 
		while (encore) {
 
			System.out.print(">");
			String command = sc.nextLine();
 
			Command(command, sc);
		}
	}
 
        public static void Cesar (Scanner sc) {
		System.out.print("Votre texte : ");
		String texte = sc.nextLine();
		texte = texte.toUpperCase();
 
		for (int i = 0; i < texte.length(); i++) {
			if (alpha.contains(texte.charAt(i))) {
				char letter = texte.charAt(i);
				int a = Arrays.binarySearch(alpha, letter);
				System.out.print(alpha[a+3]);
			}
		}
 
		System.out.print("\n");
	}
Mais sur la ligne :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
 
if (alpha.contains(texte.charAt(i))) {
J'obtiens cette erreur : Cannot invoke contains (char) on the array type char[]