J'ai préparé un extrait de code simple afin de séparer la partie erronée de mon application web.
public class Main {
public static void main(String[] args) throws IOException {
System.out.print("\nEnter a string:->");
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String temp = br.readLine();
String words[] = temp.split(".");
for (int i = 0; i < words.length; i++) {
System.out.println(words[i] + "\n");
}
}
}
Je l'ai testé en construisant une application web JSF. Je veux juste savoir pourquoi dans le code ci-dessus temp.split(".")
ne fonctionne pas. La déclaration,
System.out.println(words[i]+"\n");
n'affiche rien sur la console signifie qu'il ne passe pas par la boucle. Lorsque je change l'argument de la méthode temp.split()
à d'autres personnages, cela fonctionne très bien comme d'habitude. Quel pourrait être le problème ?