[Solved] Write a Java program that takes two inputs: 1. text 2. a word or a phrase [closed]
[ad_1] class GFG { static String censor(String text, String word) { String stars = “”; for (int i = 0; i < word.length(); i++) if (word.charAt(i) != ‘ ‘){ stars += ‘#’; }else { stars += ‘ ‘; } text = text.replaceAll(word,stars); return text; } public static void main(String[] args) { String extract = “Lorem … Read more