JAVA-13947 Potential issue in A Solid Guide to SOLID Principles article (#12654)

This commit is contained in:
anuragkumawat 2022-08-28 18:36:58 +05:30 committed by GitHub
parent 0bbab5326c
commit 1ce3754d16
2 changed files with 4 additions and 4 deletions

View File

@ -10,8 +10,8 @@ public class BadBook {
//methods that directly relate to the book properties
public String replaceWordInText(String word){
return text.replaceAll(word, text);
public String replaceWordInText(String word, String replacementWord){
return text.replaceAll(word, replacementWord);
}
public boolean isWordInText(String word){

View File

@ -9,8 +9,8 @@ public class GoodBook {
//constructor, getters and setters
//methods that directly relate to the book properties
public String replaceWordInText(String word){
return text.replaceAll(word, text);
public String replaceWordInText(String word, String replacementWord){
return text.replaceAll(word, replacementWord);
}
public boolean isWordInText(String word){