title: How to replace replace vowels with a special character in Java?
body: <pre><code>public class ReplaceVowels {
  
      public static void main(String args[]) throws IOException {
          BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
          System.out.println("Enter the String:");
          String str = bf.readLine();
  
          char[] c = new char[str.length()];
          for (int i = 0; i &lt; str.length(); i++) {
  
              if (c[i] == 'a' || c[i] == 'e' || c[i] == 'i' || c[i] == 'o'
                      || c[i] == 'u') {
  
                  System.out.println(str.replace(c[i], '?'));
  
              }
  
          }
  
      }
  }
  </code></pre>
  
  <p>why does the <code>str.replace</code> method not work? What should I do to make it work?</p>