What is needed to change so the ELSE statement will appear?
example
INPUT STRING: I want Dog
option :5 Word to be delete ?
INPUT: cat
Result: cat not found
case 5:
String word = in.nextLine();
System.out.println("Word to be delete: ");
word = in.nextLine();
if ((word) != null) {
name = name.replaceAll(word, "");
System.out.println("Result: " + name);
} else {
System.out.println("Result: " + (word) + " not found");
}
Aucun commentaire:
Enregistrer un commentaire