Ich habe diesen Code verwendet:
Code: Select all
System.out.println("Enter a sentence :");
Scanner sc = new Scanner(System.in);
String sentence = sc.nextLine();
for (int i= 0; i < sentence.length(); i ++) {
char ch = sentence.charAt(i);
if (ch != 'a' || ch !='e' || ch !='i' || ch != '0' || ch != 'u' ) {
String sentence_edited = sentence.replace(i,"");
}
}
System.out.println(sentence_edited);
Wie könnte ich das beheben?>