Skip to content

Commit a253ee6

Browse files
author
“A1-4U2T1NN”
committed
fix: changed x to letter; made letter equal to the string value of x;
1 parent 42790fc commit a253ee6

File tree

1 file changed

+2
-1
lines changed
  • lesson_11/arrays_java/arrays_app/src/main/java/com/codedifferently/lesson11

1 file changed

+2
-1
lines changed

lesson_11/arrays_java/arrays_app/src/main/java/com/codedifferently/lesson11/Lesson11.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ public List<Integer> findWordsContaining(String[] words, char x) {
2828
List<Integer> arrayOfIndices = new ArrayList<>(); // Use a List to dynamically store indices
2929

3030
for (int i = 0; i < words.length; i++) {
31-
if (words[i].contains(x)){ // Check if the character is present in the word
31+
String letter = String.valueOf(x);
32+
if (words[i].contains(letter)){ // Check if the character is present in the word
3233
arrayOfIndices.add(i); // Add the index to the list
3334
}
3435
}

0 commit comments

Comments
 (0)