title: How to avoid the occurrences of "`" and "~" symbols in a string using Java?
body: <p>I want to avoid the occurrences of  "`" and "~" symbols in a string using Java.</p>
  
  <p>Eg:</p>
  
  <p>String: hi everyo`ne</p>
  
  <p>output: invalid</p>
  
  <hr>
  
  <p>String: hi ev~eryone </p>
  
  <p>output: invalid</p>
  
  <hr>
  
  <p>String: hi everyone</p>
  
  <p>output: valid</p>
  
  <hr>
  
  <p>String: hi ev`eryon~e </p>
  
  <p>output: invalid</p>